unstage

git reset vs git reset HEAD

江枫思渺然 提交于 2019-12-17 06:38:23
问题 Every time a file has been staged, Git offers helpful instructions in the event you needed to unstage a file: (use "git reset HEAD <file>..." to unstage) However the decent Git Tutorials by Atlassian simply say: git reset <file> This seems more straightforward, so why the difference? 回答1: No difference (from git reset man page) in term of default parameter: The <tree-ish>/<commit> defaults to HEAD in all forms. That message initially did not include HEAD: commit 3c1eb9c, Jan. 2007, git 1.5.0

What is the fastest way to unstage parts of a new file in git?

跟風遠走 提交于 2019-12-04 16:39:45
问题 When I want to split up a new file into several commits I can git add -N <file> and then interactively stage lines using git gui . When I make a mistake while staging, however, git gui won't let me unstage individual lines because it is a new file (which seems like a bug to me). Of course I can always unstage the whole file and start over again, but I am wondering whether there is a more efficient way to do so. I am using git 1.7.5 . To clarify, this question is specific to new aka untracked

What is the fastest way to unstage parts of a new file in git?

对着背影说爱祢 提交于 2019-12-03 10:46:54
When I want to split up a new file into several commits I can git add -N <file> and then interactively stage lines using git gui . When I make a mistake while staging, however, git gui won't let me unstage individual lines because it is a new file (which seems like a bug to me). Of course I can always unstage the whole file and start over again, but I am wondering whether there is a more efficient way to do so. I am using git 1.7.5 . To clarify, this question is specific to new aka untracked files! From the command line type: git reset -p This will let you selectivelty unstage hunks from the

git reset vs git reset HEAD

时间秒杀一切 提交于 2019-11-27 04:00:24
Every time a file has been staged, Git offers helpful instructions in the event you needed to unstage a file: (use "git reset HEAD <file>..." to unstage) However the decent Git Tutorials by Atlassian simply say: git reset <file> This seems more straightforward, so why the difference? VonC No difference (from git reset man page ) in term of default parameter: The <tree-ish>/<commit> defaults to HEAD in all forms. That message initially did not include HEAD: commit 3c1eb9c, Jan. 2007, git 1.5.0-rc1 , but since the default is not always known, the help message makes it clear to which commit you