Magnus Therning <mag...@therning.org> ezt írta (időpont: 2016. szept. 14.,
> Gergely Polonkai <gerg...@polonkai.eu> writes:
> > Hello,
> > TL;DR: no, your branch is not polluted, your working directory is in a
> > dirty state.
> > A branch is just a pointer to a commit, so if it gets “polluted”, that
> > would mean your last commit has changed.
> > What happened is that your changes in the working directory (which,
> > you modified your file, is the representation of your last commit) has
> > left intact. This is Git's way to protect your work; if, for any reason,
> > the modified file has been changed on your master branch (like by a
> > commit+push from a fellow developer), Git would refuse the checkout
> > altogether for the very same reason: the checkout would overwrite your
> > uncommitted changes.
> > Now if you really want to abandon that change, you should reset that file
> > to the same state as it was in the last commit. Surprisingly (well,
> > somewhat), this is done by git checkout HEAD:your/modified-file.txt, not
> > git reset (as I expected a few years ago). This checkout command will
> > your changes to that file, so when you checkout your master branch, it
> > won't “pollute” it.
> Of course `git reset` *can* be used to do it, you just have to tell it
> to be hard :)
> git reset --hard HEAD
You learn something every day… Thanks! :)
> Magnus Therning OpenPGP: 0x927912051716CE39
> email: mag...@therning.org jabber: mag...@therning.org
> twitter: magthe http://therning.org/magnus
> If our ideas of intellectual property are wrong, we must change them,
> improve them and return them to their original purpose. When
> intellectual property rules diminish the supply of new ideas, they
> steal from all of us.
> — Andrew Brown, November 19, 2005, The Guardian
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.