some git usage related queries
Stathis Kamperis
ekamperi at gmail.com
Sun Nov 8 04:40:56 PST 2009
2009/11/8 Saifi Khan <saifi.khan at datasynergy.org>:
> 4. i apply some patches to a given file
> eg. Stathis' patch for mq*() syscall for MPSAFE
>
> # cd /usr/src
> # fetch http://leaf.dragonflybsd.org/~beket/mq-mpsafe.diff
> # git apply mq-mpsafe.diff
>
> Ideally i should have created a branch and then apply the
> patch. However, i applied the patch to the master.
> Some new files are created and some .bak files created.
> When i 'git pull' next, there are issues.
>
> What is a good practice to adopt here ?
>
> Is there also something as 'unapply' a patch in git ?
The right way is to use git reset as Peter said. Something like git
reset --hard HEAD. But be aware that this will reset all uncommitted
changes in your index and your working tree. So, if besides my patch
you have other stuff that you care about, take your measures.
Don't be tempted to do sth like git checkout HEAD -- path/to/file as
this will use index to restore your file. And since you used
git-apply, your index is contaminated.
In order to remove untracked files use git clean -f -d.
> i'd be grateful, if some of experienced folks on the project can
> share their nuggets of wisdom on this. Thanks for any help.
Feel free to ask, whatever you don't get from the docs.
Cheers,
Stathis
More information about the Users
mailing list