meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git:start [2015/05/20 12:17] – niziak | git:start [2025/08/05 16:16] (current) – niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | GIT PAGE | + | ====== |
| + | |||
| + | ====== Preparation ====== | ||
| + | |||
| + | ===== bash completion ===== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | Package '' | ||
| + | < | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | <file bash ~/ | ||
| + | . / | ||
| + | . / | ||
| + | |||
| + | if [ " | ||
| + | # | ||
| + | PS1=' | ||
| + | else | ||
| + | # | ||
| + | PS1=' | ||
| + | fi | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | === git-email === | ||
| + | <code bash> | ||
| + | sudo apt-get install git-email | ||
| + | git config sendemail.signedoffcc false | ||
| + | git config sendemail.suppressfrom true | ||
| + | </ | ||
| + | |||
| + | === replace github' | ||
| + | NOTE: Github was disabled git protocol. So only '' | ||
| + | |||
| + | <code bash> | ||
| + | git config --global url.https:// | ||
| + | # or | ||
| + | git config --global url.https:// | ||
| + | </ | ||
| + | |||
| + | Keywords: git protocol, '' | ||
| + | |||
| + | === replace github https links === | ||
| + | <code bash>git config --global url.git@github.com: | ||
| + | |||
| + | |||
| + | === replace own links and points to github === | ||
| + | <code bash> | ||
| + | # Remove replacement: | ||
| + | git config --unset url." | ||
| + | |||
| + | # Add replacement: | ||
| + | git config url." | ||
| + | </ | ||
| + | |||
| + | ====== Import HG (mercurial) repo ====== | ||
| + | <code bash> | ||
| + | sudo apt-get install hg-fast-export | ||
| + | git init | ||
| + | hg-fast-export -r . | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====== Usage ====== | ||
| + | |||
| + | ==== fetch moved tags ==== | ||
| + | <code bash>git fetch origin --tags --force</ | ||
| ==== Undo a commit ==== | ==== Undo a commit ==== | ||
| Undo a commit and redo | Undo a commit and redo | ||
| <code bash> | <code bash> | ||
| - | $ git commit ... | + | $ git commit ... |
| - | $ git reset --soft HEAD~1 | + | $ git reset --soft HEAD~1 |
| - | << edit files as necessary >> | + | << edit files as necessary >> |
| - | $ git add .... | + | $ git add .... |
| - | $ git commit -c ORIG_HEAD | + | $ git commit -c ORIG_HEAD |
| </ | </ | ||
| + | |||
| ==== Local copy of one branch from public repo ==== | ==== Local copy of one branch from public repo ==== | ||
| Line 26: | Line 100: | ||
| And push current branch (we are on ti-linux-3.14.y after checkout) | And push current branch (we are on ti-linux-3.14.y after checkout) | ||
| <code bash>git push -u gitlab</ | <code bash>git push -u gitlab</ | ||
| + | |||
| + | ==== repo clean and repack ==== | ||
| + | <code bash> | ||
| + | git reflog expire --expire=1.minute refs/ | ||
| + | git fsck --unreachable | ||
| + | git prune | ||
| + | git gc | ||
| + | </ | ||
| + | |||
| + | ====== Debug ====== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | <code bash> | ||
| + | GIT_TRACE=1 git clone ... | ||
| + | GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ... | ||
| + | GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git clone https://... | ||
| + | |||
| + | GIT_SSH_COMMAND=" | ||
| + | </ | ||