最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is there another layer of verbosity I can access after a failed git pull? - Stack Overflow

programmeradmin1浏览0评论

Right after successfully pushing all changes on my feature branch to the remote, I try the following on my feature branch and get the following output:

git pull origin master
From git.mycompany:core/main
 * branch                    master     -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.

Sure. Fine. Maybe I can get more information with the --verbose flag.

git pull --ff-only --verbose origin master
From git.mycompany:core/main
 * branch                    master     -> FETCH_HEAD
 = [up to date]              master     -> origin/master
fatal: Not possible to fast-forward, aborting.

Okay, that doesn't give me much more. This "verbose" message still seems extremely vague. Which leads to my question.

Is there another layer of verbosity I can access when trying to fast forward, in order to debug and fix the problem? If so, how?

Right after successfully pushing all changes on my feature branch to the remote, I try the following on my feature branch and get the following output:

git pull origin master
From git.mycompany:core/main
 * branch                    master     -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.

Sure. Fine. Maybe I can get more information with the --verbose flag.

git pull --ff-only --verbose origin master
From git.mycompany:core/main
 * branch                    master     -> FETCH_HEAD
 = [up to date]              master     -> origin/master
fatal: Not possible to fast-forward, aborting.

Okay, that doesn't give me much more. This "verbose" message still seems extremely vague. Which leads to my question.

Is there another layer of verbosity I can access when trying to fast forward, in order to debug and fix the problem? If so, how?

Share Improve this question edited Mar 31 at 10:27 Duke of the Trash Heap asked Mar 31 at 7:18 Duke of the Trash HeapDuke of the Trash Heap 234 bronze badges 7
  • 1 This question is similar to: How can I debug git/git-shell related problems?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – mkrieger1 Commented Mar 31 at 7:25
  • 2 The error is pretty clear: you can't fast-forward.... this means that pull is setup to run fast-forward only and it can't be done because your local branch and the upstream branch have diverged... what else do you need to know? – eftshift0 Commented Mar 31 at 7:25
  • 1 I'm pretty sure this has nothing to do with you pushing changes from your feature branch to the remote repository, btw. – Ulrich Eckhardt Commented Mar 31 at 7:30
  • 6 The level of verbosity that is needed here is achieved with git log --graph --oneline --decorate --boundary HEAD...origin/master. Know your commit graph! – j6t Commented Mar 31 at 9:48
  • 3 @mkrieger1 That question seems to be about a different meaning of "debug". I don't think the OP thinks there is something wrong with git, they just want to see what commits are stopping them fast-forwarding. – IMSoP Commented Mar 31 at 10:57
 |  Show 2 more comments

1 Answer 1

Reset to default 2

With git pull, this is all the verbosity you can get. A fast-foward merge was requested, e.g., by a configuration setting like pull.ff=only, but a fast-forward merge was not possible.

The next step is to know the relationship between the current HEAD and the branch tip that is being merged, i.e., to get to know the commit graph and commit history.

For a merge, the commit graph can be discovered with this git log command:

git log --graph --oneline --decorate --boundary HEAD...origin/master

The result may look like this when the histories have diverged:

* c129ba6 (HEAD -> master) more change
* 1f6b196 example commit
* 6cd8049 example fix
| * 2f51d91 (origin/master) example fix
|/  
o e244588 start

Of note are:

  • The triple-dot range notation A...B finds those commits that are reachable from only one side of the two end-points A and B. (Effectively, the commits in both A..B and B..A are listed.) In this example, 6cd8049 and above are only reachable from HEAD, while 2f51d91 is only reachable from origin/master.

  • --boundary requests that all commits at which the history traversal was stopped are also displayed. In typical simple cases, there is just one such commit, and it is the last commit common to both branches. In --graph notation it is the one with the o marker, here e244588. (In complex histories, or if a pathspec was also given, there is commonly more than one boundary commit.)

If history is complex it may be helpful to also throw in --left-right. The output marks up from which side the commits are reachable and looks like this:

< c129ba6 (HEAD -> master) more change
< 1f6b196 example commit
< 6cd8049 example fix
| > 2f51d91 (origin/master) example fix
|/  
o e244588 start

< commits are reachable from HEAD, > commits are reachable from origin/master. (It's not very useful in this simple example.)

发布评论

评论列表(0)

  1. 暂无评论