第一种情况:
qydeMacBook-Pro:testPro qy$ git status
On branch test_all
Your branch is ahead of 'origin/test_all' by 3 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
qydeMacBook-Pro:testPro qy$ git rebase origin/test_all
First, rewinding head to replay your work on top of it...
Applying: adjust file1
qydeMacBook-Pro:testPro qy$ git push
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 783 bytes | 783.00 KiB/s, done.
Total 8 (delta 5), reused 1 (delta 0)
a06d455..1c653e4 test_all -> test_all
qydeMacBook-Pro:testPro qy$ git status
On branch test_all
Your branch is up to date with 'origin/test_all'.
nothing to commit, working tree clean
第二种,有冲突的情况:
qydeMacBook-Pro:testPro qy$ git status
On branch test_com
Your branch is ahead of 'origin/test_com' by 5 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
qydeMacBook-Pro:testPro qy$ git branch
test_all
* test_com
test_qy
master
qydeMacBook-Pro:testPro qy$ git rebase origin/test_com
First, rewinding head to replay your work on top of it...
Applying: add int
Using index info to reconstruct a base tree...
M src/pages/largerecharge/index.vue
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adjust file
Using index info to reconstruct a base tree...
A file.js
A src/pages/index.vue
A src/pages/demo1/index.vue
M src/pages/demo2/index.vue
A src/pages/demo3/index.vue
M vue.config.js
Falling back to patching base and 3-way merge...
Auto-merging vue.config.js
CONFLICT (content): Merge conflict in vue.config.js
Auto-merging src/pages/demo1/index.vue
CONFLICT (content): Merge conflict in src/pages/demo1/index.vue
CONFLICT (rename/delete): env.product.js deleted in HEAD and renamed to env.production.js in LC-0000: adjust env.developer.js. Version adjust file.js of test.js left in tree.
error: Failed to merge in the changes.
Patch failed at adjust test
Use 'git am --show-current-patch' to see the failed patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort”.
qydeMacBook-Pro:sunny qy$ git add .(这一步要在解决冲突后执行,然后不用git commit直接rebase —continue)
qydeMacBook-Pro:sunny qy$ git rebase --continue
Applying: adjust file.js