Rebase的执行顺序:
git rebase from_branch to_branch
从from_branch到目标分支to_branch进行rebase。结果是from_branch的代码更新到to_branch, 同时to_branch的commit log加到from_branch的最前方。
例子:
1. git rebase remotes/main/master MYBRANCH
从远程主fork的master分支到本地分支MYBRANCH进行rebase。
2. 如果出现conflict,如
3. 解决冲突:
vim Keshin/keshin.xcodeproj/project.pbxproj
打开文件,修改并解决冲突。
4. git add Keshin/keshin.xcodeproj/project.pbxproj
5. git rebase --continue
以上。
如果出现下面的问题:
git rebase from_branch to_branch
从from_branch到目标分支to_branch进行rebase。结果是from_branch的代码更新到to_branch, 同时to_branch的commit log加到from_branch的最前方。
例子:
1. git rebase remotes/main/master MYBRANCH
从远程主fork的master分支到本地分支MYBRANCH进行rebase。
2. 如果出现conflict,如
Using index info to reconstruct a base tree...
M Keshin/keshin.xcodeproj/project.pbxproj
<stdin>:121: trailing whitespace.
<stdin>:173: trailing whitespace.
<stdin>:277: trailing whitespace.
<stdin>:329: trailing whitespace.
warning: 4 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging Keshin/keshin.xcodeproj/project.pbxproj
CONFLICT (content): Merge conflict in Keshin/keshin.xcodeproj/project.pbxproj
Failed to merge in the changes.
Patch failed at 0001 [KESHIN-381] Error Manager
The copy of the patch that failed is found in:
/Users/ou-h/Documents/Projects/src/git_src/fork_ou/katatema-ios-ou/.git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
可见,当前是文件
Keshin/keshin.xcodeproj/project.pbxproj有conflict,
3. 解决冲突:
vim Keshin/keshin.xcodeproj/project.pbxproj
打开文件,修改并解决冲突。
4. git add Keshin/keshin.xcodeproj/project.pbxproj
5. git rebase --continue
以上。
如果出现下面的问题:
`--> git rebase bug586-test master-test
First, rewinding head to replay your work on top of it...
Applying: - comiitting code related to api permissions
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
inc/data.inc
templates/apipermissions_tpl.inc
templates/currencies_tpl.inc
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0001 - comiitting code related to api permissions
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
解决:
I'm on a mac, and this obscure config change seemed to fix all my woes regarding unstaged changes when there were none.
git config --global core.trustctime false
I think it's to do with differences between windows file times, linux file times and mac file times. who knows, feel free to comment if you do.
以上。