git ready » temporarily ignoring files

git ready » temporarily ignoring files

Usually ignoring files is quite simple with Git. However, you may need to quickly hide changes in a file, perhaps for an entire development session or other reasons. Luckily there’s a simple way around this, thanks to some clever manual diving from Eelco Wiersma.

His main problem was using git commit -a, which automatically adds files that are modified into the commit object. This is a neat shortcut, but make sure you understand the staging area if you find yourself running this command all the time.

So, to temporarily ignore changes in a certain file, run:

git update-index –assume-unchanged

Then when you want to track changes again:

git update-index –no-assume-unchanged

via git ready » temporarily ignoring files.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s