From a414247ea68792ef413a3b6b5fc24ef0c3308468 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Thu, 26 Mar 2015 10:26:56 -0700 Subject: [PATCH] Development notes --- notes.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/notes.md b/notes.md index 548c66aab..cf5b2fcd6 100644 --- a/notes.md +++ b/notes.md @@ -8,11 +8,14 @@ To automatically stage files that have been modified and deleted, include -a; eg git commit -a -Creating a new branch ("386dev") after modifying one or more files +Creating a new branch ("386dev") --- - git checkout -b 386dev +You could use `git branch`, but if you've already modified some files that you now want to +move to a new branch: + git checkout -b 386dev + Pushing a new branch ("386dev") --- @@ -27,3 +30,20 @@ do this instead: git push -u origin 386dev +Reverting (resetting) a single file [[link](http://www.norbauer.com/rails-consulting/notes/git-revert-reset-a-single-file.html)] +--- + +If you have an uncommitted change (it's only in your working copy) that you wish to revert (in SVN terms) +to the copy in your latest commit, do the following: + + git checkout filename + +This will checkout the file from HEAD, overwriting your change. This command is also used to checkout branches, +and you could happen to have a file with the same name as a branch. All is not lost, you will simply need to type: + + git checkout -- filename + +You can also do this with files from other branches, and such. `man git-checkout` has the details. + +The rest of the Internet will tell you to use `git reset --hard`, but this resets all uncommitted changes you’ve +made in your working copy. Type this with care.