摘要
在origin仓库中代码的发有master 和其他三个分支。
[root@localhost Git_Learn]# git push origin xjl-branch1
To git@github.com:zhuangxiaoyan512/Git_Learn.git
! [rejected] xjl-branch1 -> xjl-branch1 (non-fast-forward)
error: failed to push some refs to 'git@github.com:zhuangxiaoyan512/Git_Learn.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git status
# On branch xjl-branch1
# Your branch and 'origin/xjl-branch1' have diverged,
# and have 1 and 1 different commit each, respectively.
# (use "git pull" to merge the remote branch into yours)
#
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# deleted: branch1
解决办法
现将master将合并到当前分支(rebase)
git rebase master
First, rewinding head to replay your work on top of it...
Applying: "feat(service) [vxp-8695] :branc1"
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Applying: delete branch1