minnymouse@XXXXXXX /c/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX (development)
$ git status
On branch development
Your branch is ahead of 'origin/development' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
minnymouse@XXXXXXX /c/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX (development)
$ git push origin development
To ssh://xxxxxx/xxx/xxxxx/git/repos/xxxxx
! [rejected] development -> development (fetch first)
error: failed to push some refs to 'ssh://xxxxxx/xxx/xxxxx/git/repos/xxxxx'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
minnymouse@XXXXXXX /c/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX (development)
$ git pull
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 10 (delta 5), reused 0 (delta 0)
Unpacking objects: 100% (10/10), 1.06 KiB | 43.00 KiB/s, done.
From ssh://xxxxxx/xxx/xxxxx/git/repos/xxxxx
7948726..7dc3f5c development -> origin/development
b9042ed..d04db55 feature/luxor -> origin/feature/luxor
7948726..7dc3f5c production -> origin/production
hint: Waiting for your editor to close the file...
如果我关闭编辑器而没有评论,是否会完全中止拉取?如果不是,编辑器文件中的消息是什么意思:
# Lines starting with '#' will be ignored, and an empty message aborts the commit.
所有这些都会集成到我的本地开发副本中吗?如果不是,这样做的目的是什么?
7948726..7dc3f5c development -> origin/development
b9042ed..d04db55 feature/luxor -> origin/feature/luxor
7948726..7dc3f5c production -> origin/production
如果您关闭编辑器,它不会中止拉取。当您再次打开它时,您仍处于合并状态。
这里发生的事情是,你正试图将代码推送到开发远程分支。但是,它识别出你没有及时了解当前开发中的内容。因此,它拒绝了你的推送,并告诉你先拉取当前的开发状态,以便 git 可以确定是否存在任何需要解决的合并冲突,然后才能推送。
在这种情况下,您没有任何合并冲突。当提示
# Lines starting with '#' will be ignored, and an empty message aborts the commit.
出现时,这是 vi 或 vim 要求您进行交互。如果它已经处于输入模式,您只需输入:wq
并按回车键。然后您可以再次推送。如果不是处于输入模式,您需要按i,然后根据需要输入合并消息,然后esc,输入
:wq
并点击enter最终,您似乎想要拥有自己的本地分支,可以将其推送到该分支,然后稍后将其合并到开发中,最好是通过拉取请求。
要启动您自己的新的本地开发分支,您需要处于开发状态,确保您拥有最新的副本,
git pull
然后执行git checkout -b branchName
以下操作:git checkout -b my-new-branch