Tuesday, 15 July 2014

How to checkout a git revision without changing working copy -



How to checkout a git revision without changing working copy -

recently i've been using git scheme applies patches commits (phabricator & arcanist, don't think thats of import question).

i end in situation have patch applied in form of commit, edit commit. of course of study can create edits , git commit --amend, i'd able git diff, utilize meld . , other tools assume edits made on-top of lastly commit.

currently following.

git diff head~1 > temp.diff git reset --hard head~1 git apply temp.diff rm temp.diff

edit patch...

git commit -a

however seems bit clumsy, there way set git repository sha1, maintain current working re-create intact?

you should able simplify reset using:

git reset @~

that reset head previous commit, , reset index, not working tree. used default reset mode (like git reset --mixed)

a git diff should show lastly patch was. git status should show lastly modified files, ready modified/added beck index , committed again.

git

No comments:

Post a Comment