Category Archives: Git

Cleanup local Git from deleted remote branches

By | January 20, 2018

When working with Git after some time local repository has excess branches which create a mess. There is an easy way to remove branches from local repo that were deleted from remote. Before Git 1.6.6 Two steps are needed: fetch and prune git fetchgit remote prune your_remote your_remote – for example origin Git 1.6.6 and above This version introduced command that combines… Read More »

Git – Create New Branch From Existing Branch

By | January 5, 2018

To create a new branch from existing one you first have to checkout new branch locally, then push it to remote so other can see it. Below are the exact commands. Create new branch from existing branch locally git checkout -b {NEW_branch_name} {SOURCE_branch_name} Specifying -b causes a new branch to be created Push changes to origin git push origin {NEW_branch_name}

Git – Delete Both Local and Remote Branch

By | March 10, 2017

Deleting branches in Git is something done frequently, especially in GitFlow. Here are commands to delete local and remote branches. Remove a local branch from your machine git branch -d {the_local_branch_name} (use -D instead to force deletion, without checking merged status) Remove a remote branch from the server git push origin --delete {the_remote_branch_name}