Git config
git config --global user.email "[email protected]"
git config --global user.name "ıqO"
git branch -av  #list all branchesWorking with tags (https://git-scm.com/book/en/v2/Git-Basics-Tagging)
git tag <tag-name> 
git push --tags  
to delete a tag.
git tag -d <tag-name> 
git push origin :refs/tags/<tag-name> Delete specific commit
get the commit SHA
eg `36f408486d3b12218ce9c1e0f5d54f5d273`
Run:
`git rebase -p --onto SHA^ SHA`
git rebase -p --onto 36f408486d3b12218ce9c1e0f5d54f5d273^ 36f408486d3b12218ce9c1e0f5d54f5d273
// fix any merge conflicts
git add . && git commit -m'nuke commit' && git push origin HEAD:master
Working with remotes
Show Remote:
git remote -v
git remote show <remote>
add remote
git remote add origin [email protected]:.git
change remote url:
git remote set-url origin [email protected]:.git
remove remote
git remote remove originSyncing repositories(Sync upstream repository with forked repository)
git remote add upstream https://github.com/[company]/[project].git
git fetch upstream
git checkout master
git merge upstream/master
remember to check origin
git remote -v
git push origin masterSearch for specific commit
git log --all --grep='c351b1f4b13ccd33c7a5f23b4eccdb2a1c6a4'Working with submodules
git submodule add -f <https://github.com/[].git> [destination directory]
git submodule add -f https://github.com/myrepo/myplugin.git wp-content/plugins/mypluginDeleting a remote branch:
git push origin --delete <branch>  # Git version 1.7.0 or newer
git push origin :<branch>          # Git versions older than 1.7.0
Deleting a local branch:
git branch --delete <branch>
git branch -d <branch> # Shorter version
git branch -D <branch> # Force delete un-merged branchesRENAMING BRANCHES
- Rename your local branch.
If you are on the branch you want to rename:
git branch -m new-name
If you are on a different branch:
git branch -m old-name new-name
- Delete the old-name remote branch and push the new-name local branch.
git push origin :old-name new-name
- Reset the upstream branch for the new-name local branch.
Switch to the branch and then:
git push origin -u new-nameMerge unrelated histories
git pull origin master --allow-unrelated-histories