git
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git [2020-09-10] – [Remove submodule] hanez | git [2025-07-13] (current) – ↷ Links adapted because of a move operation 217.113.194.145 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Git Notes ====== | + | ====== Git ====== | 
| - | Specify the private SSH-key to use when executing a Git command: | + | ===== Add tag ===== | 
| - |  | + | <code shell> | 
| + | |||
| + | ==== Commit a tag ==== | ||
| + | |||
| + | < | ||
| + | |||
| + | ==== Commit all tags ==== | ||
| + | |||
| + | < | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | ===== Checkout a specific tag ===== | ||
| + | |||
| + | <code bash>git checkout TAG</ | ||
| + | |||
| + | More: [[https:// | ||
| + | |||
| + | ===== Clone a specific tag ===== | ||
| + | |||
| + | <code bash>git clone --depth 1 --branch < | ||
| + | |||
| + | More: [[https:// | ||
| + | |||
| + | ===== Specify the private SSH-key to use when executing a Git command: ===== | ||
| + | |||
| + | <code bash>ssh-agent bash -c ' | ||
|  |  | ||
| Example: | Example: | ||
| - |  | + | <code bash>ssh-agent bash -c ' | 
| Source: [[https:// | Source: [[https:// | ||
| Line 15: | Line 41: | ||
| 0. mv a/submodule a/ | 0. mv a/submodule a/ | ||
| - | 1. git submodule deinit -f -- a/ | + | 1. git submodule deinit -f -- a/submodule | 
| 2. rm -rf .git/ | 2. rm -rf .git/ | ||
| - | 3. git rm -f a/submodule | ||
| - | # Note: a/submodule (no trailing slash) | ||
| - | # or, if you want to leave it in your working tree and have done step 0 | + | 3. git rm -f a/ | 
| - | 3. | + | ==== or, if you want to leave it in your working tree and have done step 0 ==== | 
| + | |||
| + | 3. git rm --cached a/submodule | ||
| 3bis mv a/ | 3bis mv a/ | ||
| Source: [[https:// | Source: [[https:// | ||
| + | |||
| + | ===== git undo all uncommitted or unsaved changes ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | Or: | ||
| + | |||
| + | < | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | ===== How to undo local changes to a specific file ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | ===== Undo all uncommitted or unsaved changes ===== | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | ===== Getting the difference between two repositories ===== | ||
| + | |||
| + | < | ||
| + | git remote update | ||
| + | git diff master remotes/ | ||
| + | git remote rm b</ | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | |||
| + | ===== How do I " | ||
| + | |||
| + | So, first commit/push your submodule' | ||
| + | |||
| + | < | ||
| + | git add < | ||
| + | git commit -m " | ||
| + | git push</ | ||
| + | |||
| + | Then, update your main project to track the updated version of the submodule: | ||
| + | |||
| + | < | ||
| + | git add path/ | ||
| + | git commit -m " | ||
| + | git push</ | ||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | ===== Remove sensitive files and their commits from Git history ===== | ||
| + | |||
| + | < | ||
| + | git push --force --verbose --dry-run | ||
| + | git push --force</ | ||
| + | |||
| + | |||
| + | Source: [[https:// | ||
| + | |||
| + | ===== How to merge two or multiple git repositories into one ===== | ||
| + | |||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
git.1599770371.txt.gz · Last modified:  by hanez
                
                