我习惯使用SVN,最近才切换到GitHub.
我正在尝试更新GitHub仓库中的一些文件,但我收到此消息:
To https://github.com/.../
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/.../'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
我试图像命令git fetch origin和git pull,但这些都不让,所以我的当前分支并没有落后.
在SVN我只是做svn update,然后提交我的更改.
我也试过了git pull origin,但是我弹出一条奇怪的短信,我不知道如何与它交互:用Github存储库中的更改来更新本地存储库
Bre*_* ho 22
1)检查您当前的分支
__CODE__
它将使用星号(*)显示您当前的分支名称.
2)然后使用远程分支更新本地分支
__CODE__(这是带星号的分支名称)
3)现在,如果您已经提交了本地更改,则可以将代码推送到远程仓库.
__CODE__
如果你还没有投入,先做提交,然后做git pull and push.
git在拉的时候打开编辑器是正常的。这是因为您正在合并从远程分支到本地分支的更改。
在 pull 时,git 会检测是否需要将您的本地分支与远程分支合并。如果它需要合并,它将这样做并为您提供为合并提交编写自定义消息的机会。此时,您可以选择仅关闭编辑器,然后 git 将完成该过程。
基本上,您所要做的就是关闭编辑器,您就可以完成了。
本质上,git 正在执行以下操作:
#Download all the commits from the remote
git fetch origin
# Merge in the commits from the remote to your local branch
# If anything needs merging, this will open a text editor
git merge origin/master master
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
69502 次 |
| 最近记录: |