The GitHub Gist at https://gist.github.com/robsontenorio/7128003 is a popular collection of useful Git commands and aliases designed to streamline everyday version control workflows. While exact content may vary slightly (Gists can be updated), it typically includes:
Key Aliases
Shortcuts for frequent commands to save time:
st=git statusco=git checkoutbr=git branchci=git commitlg= A pretty log (e.g.,git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset"to visualize branch history with authors/dates).
Common Workflows
Practical commands for common tasks:
- Undo/Reset:
- Undo last commit (soft: keep changes, hard: discard):
git reset --soft HEAD~1/git reset --hard HEAD~1 - Unstage files:
git reset HEAD <file>
- Undo last commit (soft: keep changes, hard: discard):
- Branch Management:
- Delete local branch:
git branch -d <branch> - Delete remote branch:
git push origin --delete <branch>
- Delete local branch:
- Stashing:
- Save temporary changes:
git stash - Apply latest stash:
git stash apply
- Save temporary changes:
- Cleanup:
- Remove merged branches:
git branch --merged | grep -v "\*" | xargs git branch -d
- Remove merged branches:
- Syncing:
- Update a forked repo with upstream:
git fetch upstream && git merge upstream/main
- Update a forked repo with upstream:
For the exact, up-to-date content, visit the Gist link directly. It’s a go-to reference for both Git beginners and experienced users!

作者声明:本文包含人工智能生成内容。