简体   繁体   中英

How to apply an old commit on Git?

So, I'm trying to apply an old commit by using cherry-pick, but seems more difficult than I thought.

This is what the BASH looks like...

--HEAD IS IN THE MASTER BRANCH-
git cherry-pick 6a0c632
error: could not apply 6a0c632...
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths> or "git rm <paths>'
hint: and commit the result with 'git commit'

I've been using Git for only 2 months and the only commands I've used are the basic ones: add, commit, push, pull...

Step 1 : Fix merge conflicts.

Step 2 : Add fixed file(s).

git add <fixed_file>

Step 3 . Continue the cherry-pick.

git cherry-pick --continue
error: could not apply zp39187... my message
When you have resolved this problem, run "git rebase --continue".

is an often reoccuring error.

A main reason of this happening is because (in my case) commit 'zp39187' is causing a conflict .

An often reoccurring 'solution' is to fix the conflict OR skip it by using:

git rebase --skip

The error however also seems to turn up while cherry-picking.

This link might be helpful: Add commits before root commit in Git? , since it looks very related.

I hope it's helpful in some way.. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM