| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| git_cheat_sheet [2022/11/30 22:26] – [Install] stephen | git_cheat_sheet [2024/06/17 09:49] (current) – external edit 127.0.0.1 |
|---|
| editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession | editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession |
| pager = cat | pager = cat |
| | longpaths = true |
| |
| [user] | [user] |
| fa = fetch -a | fa = fetch -a |
| tf = !git reset && git checkout -- . && git clean -df | tf = !git reset && git checkout -- . && git clean -df |
| | as = !git add . && git stash |
| | pr = !git stash pop && git reset |
| brdr = push --delete origin | brdr = push --delete origin |
| fp = push --force | fp = push --force |
| | ''<nowiki>git push origin <hash>:<branch></nowiki>'' | Push up to a certain commit. | | | ''<nowiki>git push origin <hash>:<branch></nowiki>'' | Push up to a certain commit. | |
| | ''<nowiki>git push origin HEAD~10:<branch></nowiki>'' | Push up to the last 10 commits. | | | ''<nowiki>git push origin HEAD~10:<branch></nowiki>'' | Push up to the last 10 commits. | |
| | | ''<nowiki>git push origin HEAD~10:$(git rev-parse --abbrev-ref HEAD)</nowiki>'' | Push up to the last 10 commits. | |
| | | ''<nowiki>git push --force origin HEAD~10:$(git rev-parse --abbrev-ref HEAD)</nowiki>'' | Force push up to the last 10 commits. | |
| | ''<nowiki>gitk</nowiki>'' | A commit viewer. | | | ''<nowiki>gitk</nowiki>'' | A commit viewer. | |
| | ''<nowiki>gitk 'stash@{0}'</nowiki>'' | View the contents of the first stash. | | | ''<nowiki>gitk 'stash@{0}'</nowiki>'' | View the contents of the first stash. | |
| | ''<nowiki>git log --no-merges --oneline develop..</nowiki>'' | Show all commits on the current branch. | | | ''<nowiki>git log --no-merges --oneline develop..</nowiki>'' | Show all commits on the current branch. | |
| | ''<nowiki>git cherry-pick ebe6942^..905e279</nowiki>'' | Cherry-pick an //inclusive// commit range. | | | ''<nowiki>git cherry-pick ebe6942^..905e279</nowiki>'' | Cherry-pick an //inclusive// commit range. | |
| | | ''<nowiki>git remote -v</nowiki>'' | View remote / origin URL. | |
| |
| ===== Workflows ===== | ===== Workflows ===== |
| <code> | <code> |
| git svn clone https://ares/svn/SVNRepository/Presentations --no-metadata --tags=Tags --trunk=Trunk --branches=Branches --authors-file=..\users.txt | git svn clone https://ares/svn/SVNRepository/Presentations --no-metadata --tags=Tags --trunk=Trunk --branches=Branches --authors-file=..\users.txt |
| | </code> |
| | |
| | ===== Who needs to clean up ===== |
| | |
| | Lists the author and date of the last commit on each remote branch. Need to run it on bash. |
| | |
| | <code> |
| | for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r |
| </code> | </code> |
| |