Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:git [2018/05/24 09:16] billdozor [Upstream Repo Sync] |
linux_wiki:git [2020/01/10 18:29] (current) 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 42: | Line 44: | ||
\\ | \\ | ||
Verify version< | Verify version< | ||
- | |||
- | ---- | ||
- | |||
- | ===== Source ===== | ||
- | |||
- | Newer versions of Git can be installed from source. | ||
- | |||
- | TODO | ||
---- | ---- | ||
Line 55: | 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 85: | 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 140: | 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 282: | 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. | ||
Line 294: | Line 326: | ||
* Verify upstream was added< | * Verify upstream was added< | ||
+ | |||
+ | ==== Syncing Fork to Upstream ==== | ||
* Fetch upstream' | * Fetch upstream' | ||
Line 302: | Line 336: | ||
* 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/remove ' | ||
+ | \\ | ||
+ | |||
+ | * Fix/remove ' | ||
---- | ---- | ||