Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
linux_wiki:git [2018/05/24 09:07] billdozor [Repos] |
linux_wiki:git [2020/01/10 18:29] billdozor [Extra Characters in git diff] |
||
---|---|---|---|
Line 4: | Line 4: | ||
Useful git commands when managing git repos. | Useful git commands when managing git repos. | ||
+ | |||
+ | Official site: https:// | ||
**Checklist** | **Checklist** | ||
Line 22: | Line 24: | ||
</ | </ | ||
+ | \\ | ||
==== IUS Repos ==== | ==== IUS Repos ==== | ||
Line 28: | Line 31: | ||
It is similar to Software Collections, | It is similar to Software Collections, | ||
+ | \\ | ||
Add the IUS Repo | Add the IUS Repo | ||
* CentOS 7<code bash>yum install https:// | * CentOS 7<code bash>yum install https:// | ||
* CentOS 6<code bash>yum install https:// | * CentOS 6<code bash>yum install https:// | ||
+ | \\ | ||
Remove the system provided version (if installed)< | Remove the system provided version (if installed)< | ||
+ | \\ | ||
Install the IUS git version< | Install the IUS git version< | ||
+ | \\ | ||
Verify version< | Verify version< | ||
- | |||
- | ===== Source ===== | ||
- | |||
- | Newer versions of Git can be installed from source. | ||
- | |||
- | TODO | ||
---- | ---- | ||
Line 48: | Line 49: | ||
====== Initial Git Config Setup ====== | ====== Initial Git Config Setup ====== | ||
- | Setup your name for commits: | + | Setup your user name for commits: |
<code bash> | <code bash> | ||
git config --global user.name " | git config --global user.name " | ||
Line 78: | Line 79: | ||
</ | </ | ||
- | ---- | + | \\ |
- | + | Disable https verify for self signed certs on a single cloned repo<code bash> | |
- | ====== Clone Repos ====== | + | |
- | + | ||
- | Download an existing project via URL<code bash> | + | |
\\ | \\ | ||
- | Download an existing project via HTTPS URL and do not verify ssl cert for self signed<code bash>git -c http.sslVerify=false clone https://URL</code> | + | Alternatively, |
---- | ---- | ||
- | ====== | + | ====== |
- | Disable https verify for self signed certs on a single cloned | + | Create a new local project (to be pushed up to a repo later)<code bash> |
\\ | \\ | ||
- | Alternatively, | + | Download an existing project via URL<code bash>git clone URL</ |
+ | |||
+ | \\ | ||
+ | Download an existing project via HTTPS URL and do not verify ssl cert for self signed<code bash>git -c http.sslVerify=false clone https://URL</code> | ||
---- | ---- | ||
Line 133: | Line 134: | ||
* View recent commits with diff details< | * View recent commits with diff details< | ||
* Retrieve the commit SHA hash from the above and revert that push< | * Retrieve the commit SHA hash from the above and revert that push< | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Exclude Files from Tracking ====== | ||
+ | |||
+ | A plain text file called ' | ||
+ | |||
+ | Full documentation here: https:// | ||
+ | |||
+ | \\ | ||
+ | Example .gitignore< | ||
+ | __pycache__/ | ||
+ | *.log | ||
+ | tmp/</ | ||
+ | * Do not track any files that | ||
+ | * Are inside a __pycache__ directory | ||
+ | * End in .log | ||
+ | * Are inside a tmp directory | ||
+ | |||
+ | \\ | ||
+ | List all ignored files in the current project< | ||
---- | ---- | ||
Line 275: | Line 297: | ||
---- | ---- | ||
+ | |||
+ | ===== Deleting Branches ===== | ||
+ | |||
+ | Delete a remote branch< | ||
+ | |||
+ | \\ | ||
+ | Delete a local branch< | ||
+ | |||
+ | \\ | ||
+ | Prune remote list if remote branches were deleted by someone else< | ||
+ | |||
+ | ---- | ||
+ | |||
===== Upstream Repo Sync ===== | ===== Upstream Repo Sync ===== | ||
If your cloned repo is a fork, you will want to keep it synced with the upstream project from time to time. | If your cloned repo is a fork, you will want to keep it synced with the upstream project from time to time. | ||
+ | |||
+ | ==== Add Upstream Source ==== | ||
+ | |||
+ | Adding the upstream repo to your local cloned fork only needs to be done one time. | ||
* In the terminal, navigate to the directory of the cloned repo. | * In the terminal, navigate to the directory of the cloned repo. | ||
+ | |||
* View current remote repos for the fork:< | * View current remote repos for the fork:< | ||
+ | |||
* Add the upstream project< | * Add the upstream project< | ||
+ | |||
* Verify upstream was added< | * Verify upstream was added< | ||
+ | |||
+ | ==== Syncing Fork to Upstream ==== | ||
+ | |||
* Fetch upstream' | * Fetch upstream' | ||
+ | |||
* Check out the local master branch for your fork< | * Check out the local master branch for your fork< | ||
+ | |||
* Merge changes from the upstream project into the local master branch< | * Merge changes from the upstream project into the local master branch< | ||
+ | |||
* Push local changes to your fork on github< | * Push local changes to your fork on github< | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Troubleshooting ====== | ||
+ | |||
+ | Fixing different git issues. | ||
+ | |||
+ | ===== Extra Characters in git diff ===== | ||
+ | |||
+ | * Fix ' | ||
+ | \\ | ||
+ | |||
+ | * Fix ' | ||
---- | ---- | ||