Git
Commands
How do I rename both a Git local and remote branch name?
git branch -m <oldBranchName> <newBranchName>
git push origin :<oldBranchName>
git push --set-upstream origin <newBranchName>
If you don't want to keep these changes, simply use the --hard flag. Be sure to only do this when you're sure you don't need these changes anymore.
git reset --hard HEAD~1
To modify the latest remote commit message
git commit --amend -m "xxxxxxx"
Delete the remote branch
git push origin --delete remotes/origin/feat/project-layout
Prune the remote branch
git remote prune origin
To display all branch in git log --graph
git log --all --decorate --graph
To pick a commit to specify branch
git cherry-pick <commitSha>
To clear the git stash
git stash clear
To reset the commit
git reset --soft <commitSha>
Push a empty commit
git commit --allow-empty -m "xxxxxxxxxx"
Git configuration
git config --global user.name "John Doe"
git config --global user.email [email protected]
Enable GPG signing
git config --global user.signingkey KEY-ID
git config --global commit.gpgsign true
To show the branch --verbose
git branch -vv
To patch the chenged file
git restore/add -p <fileName>