Nul*_*ptr 29 git git-pull git-push git-commit
我还是git新手.我修改了一些源文件并提交了.然后,我做到了git push.但是,我收到了这个错误.
To /foo/bar/ ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/foo/bar/' To prevent you from
losing history, non-fast-forward updates were rejected Merge the
remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
这似乎拒绝,我也没有git pull之前push.所以,我做到了git pull.好的,其他人有两个修改过的文件.
然后,我 git push成功了.
问题:在这种情况下,我会看到一个更多的日志,如下面的原始提交消息:
commit 59e04ce13b8afa...
Merge: 64240ba 76008a5
Author: Jone Doe <jone@doe.com>
Date: Fri Mar 15 11:08:55 2013 -0700
Merge branch 'master' of /foo/bar/
Run Code Online (Sandbox Code Playgroud)
这是我原来的提交消息.
commit 64240bafb07705c...
Author: Jone Doe <jone@doe.com>
Date: Fri Mar 15 11:06:18 2013 -0700
Fixed bugs and updated!
Run Code Online (Sandbox Code Playgroud)
我想了解为什么添加"merge branch master of location".
r.v*_*r.v 21
当您执行a时git-pull,远程分支的修改将合并到您的本地分支中.自动生成的提交表示.
合并可能会导致冲突,然后需要手动解决.在你的特定情况下,这没有发生,git可以处理所有事情.
von*_*and 10
如果其他人可能有变化,那么最好做一个git pull --rebase(即在远程更改后添加新的更改;这可能会发现您必须解决的冲突),然后git push是结果.要小心,这会创建以前从未存在过的新提交(与任何历史记录重写一样),但它提供了一个干净的线性历史记录(没有合并的纠结)
| 归档时间: |
|
| 查看次数: |
27342 次 |
| 最近记录: |