Clean up your local git repo
Where I work, it's pretty common to switch between projects, and often enough, a project will have changed somewhat since the last time I was in there. So that means I need to sync my local repo with the remote before I create my feature branch. I want to make sure I'm getting a good clean build and I don't have any old artifacts lying around, gumming up the works.
So, I make sure to clean out unneeded files and reset my branch to a good state. I found myself doing this often enough that I created an alias in my .gitconfig to do this for me.
[alias]
nuke = !git clean -fdx & git reset head --hard & git pull
So now from the project root I type:
git nuke
And I'm assured that what I've got locally is exaclty what's in the remote repo, and I can create my feature branch and get to work.
HTH,
Mike
Written by Michael Ibarra
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#