Git Checkout

I just want to record down the 2 common usages of git checkout so that I don’t need to refer again next time!

git checkout — <filename>

  • this will overwrite your file with the name <filename> in your working directory with the <filename> from the staging area.

git checkout -f

  • replace all the files in the working directory with files from HEAD
  • clear the staging area to match with HEAD
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