nickarthur
4/29/2018 - 3:43 AM

Git commands

Git commands

# Removing a branch

Local  : git branch -D <branch>
Remote : git push origin :<branch>

#---------------------------

# Rename commit message
# ref: http://darrinholst.com/post/359817782

git rebase -i <commit-hash>


#---------------------------

# Rename branch

git branch -m <old_branch> <new_branch>

#---------------------------

# Keeping a clean GitHub fork.
# Ref: http://blog.evan.pro/keeping-a-clean-github-fork-part-1

git remote add upstream <git-url-project>
git fetch upstream
git merge --ff-only upstream/master
git pull --ff-only upstream master
git push origin master
git fetch --all

#---------------------------

# Properly excluding IDE-specific files with Git
# Ref: http://blog.evan.pro/properly-excluding-ide-specific-files-with-git

git config --global core.excludesfile ~/.gitignore_global

#---------------------------

# Rename a tag

git tag new_tag old_tag
git push --tags
git push origin :refs/tags/old_tag
git tag -d old_tag