Posted in: Git

Fix for git not fetching all branches

Posted on February 26, 2017 by Michael Roma

Below is a fix for if your git fetch does not fetch all branches

First run the following command:

$ git config --get remote.origin.fetch

If the value returned is not equal to:


Then run this to set the config:

$ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

How to stop tracking a file already committed in git

Posted on October 26, 2016 by Michael Roma

Use the following command to remove a file or pattern from git:

git rm -r --cached my-file.js

You would then update your .gitignore to exclude this file or pattern

git Command Cheatsheet

Posted on November 10, 2015 by Michael Roma

Clean working copy

$ git clean -df
$ git checkout -- .

Temporarily stashing changes before pulling

$ git stash 
$ git pull
$ git stash pop    

Pull from master branch

git checkout stage
git fetch origin
git merge origin/master

Find all branches that are merged

git branch --merged

Find all remote branches that are merged

git branch -r --merged > branches.txt

Delete a local branch

git branch -d [branch-name]

Delete a remote branch

git branch -rd [branch-name]
git push origin :[branch-name]

Cancel a merge

git reset --hard HEAD