List some useful git commands.
Last active
April 14, 2023 07:41
-
-
Save Hansimov/23bb639911d474c7ab5b93d32bcbd99d to your computer and use it in GitHub Desktop.
Collection of useful git commands in daily work
Author
Author
Gist remove/squash some revisions:
References:
- git - How to delete a specific revision of a github gist? - Stack Overflow
NOTE: Do not forget to remove the # after rebase in order to add a valid commit message after squashing
Author
Git change author of previous commit:
git commit --amend --author="Author Name <email@address.com>" --no-edit
References:
- git - How to change the commit author for a single commit? - Stack Overflow
Author
Git update submodules to latest commit:
git submodule foreach git pull
or submodule is in detached state:
git submodule foreach git pull origin main # (master)References:
- Update Git submodule to latest commit on origin - Stack Overflow
Author
Git pull submodule:
git submodule update --init --recursive # (First time)
git submodule update --recursive --remoteReferences:
- Pull latest changes for all git submodules - Stack Overflow
Author
Remove contributor from GitHub repo page:
- On GitHub web page, change a branch name (e.g.,
main-->main1).- It updates the contributor list on the GitHub repo dashboard.
- Then change it back (
main1-->main).
References:
- git - Removing contributor from github.com? - Stack Overflow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Auto complete git branch names in (t)csh
Download
git-completion.bashandgit-completion.tcsh:Add following lines to
~/.cshrc: