我有两个分支(A和B),我想将A分支中的一个文件与B分支中相应的一个文件合并。
我有两个分支(A和B),我想将A分支中的一个文件与B分支中相应的一个文件合并。
# If you did a git pull and it broke something, do this first
# Find the one before the merge, copy the SHA1
git reflog
git reset --hard <sha1>
# Get remote updates but DONT auto merge it
git fetch github
# Checkout to your mainline so your branch is correct.
git checkout develop
# Make a new branch where you'll be applying matches
git checkout -b manual-merge-github-develop
# Apply your patches
git checkout --patch github/develop path/to/file
...
# Merge changes back in
git checkout develop
git merge manual-merge-github-develop # optionally add --no-ff
# You'll probably have to
git push -f # make sure you know what you're doing.
git checkout <target_branch>
git checkout <source_branch> <file_path>