* git pull --ff-only errors when git merge --ff-only passes
@ 2024-06-03 6:28 Arundas T C
2024-06-03 15:31 ` Junio C Hamano
2024-06-03 21:30 ` brian m. carlson
0 siblings, 2 replies; 3+ messages in thread
From: Arundas T C @ 2024-06-03 6:28 UTC (permalink / raw)
To: git
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
1. In a remote repository, have a commit that's only in remote at the
tip of the current branch in local.
2. In the local clone of this repository, edit some files and have
unstaged changes.
3. In local, run `git pull --ff-only`.
What did you expect to happen? (Expected behavior)
Fast-forward the local branch to match the remote branch, similar to
`git merge --ff-only`. Handle any merge conflicts the same way that
`git merge --ff-only` does.
What happened instead? (Actual behavior)
error: cannot pull with rebase: You have unstaged changes.
error: Please commit or stash them.
What's different between what you expected and what actually happened?
It errored out because of unstaged changes, even though doing `git
merge --ff-only` will correctly do what's expected. See below.
Anything else you want to add:
After doing `git fetch`, I can do `git merge --ff-only` and this
fast-forwards the branch as expected. Isn't `git pull --ff-only`
basically the same as doing these two (fetch and merge)?
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.45.1
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58
PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64
compiler info: clang: 15.0.0 (clang-1500.3.9.4)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh
[Enabled Hooks]
post-checkout
post-commit
post-merge
pre-push
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git pull --ff-only errors when git merge --ff-only passes
2024-06-03 6:28 git pull --ff-only errors when git merge --ff-only passes Arundas T C
@ 2024-06-03 15:31 ` Junio C Hamano
2024-06-03 21:30 ` brian m. carlson
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2024-06-03 15:31 UTC (permalink / raw)
To: Arundas T C; +Cc: git
Arundas T C <arundas.tc@gmail.com> writes:
> What happened instead? (Actual behavior)
>
> error: cannot pull with rebase: You have unstaged changes.
> error: Please commit or stash them.
>
> What's different between what you expected and what actually happened?
>
> It errored out because of unstaged changes, even though doing `git
> merge --ff-only` will correctly do what's expected. See below.
But you are not doing "merge" but "rebase", according to the error
message. "pull" was told to do "rebase" instead of "merge" and it
stopped because it did not want to clobber the local changes. So
it appears that what "merge --ff-only" would have do has very little
to do with what "pull --ff-only" you configured would do, no?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git pull --ff-only errors when git merge --ff-only passes
2024-06-03 6:28 git pull --ff-only errors when git merge --ff-only passes Arundas T C
2024-06-03 15:31 ` Junio C Hamano
@ 2024-06-03 21:30 ` brian m. carlson
1 sibling, 0 replies; 3+ messages in thread
From: brian m. carlson @ 2024-06-03 21:30 UTC (permalink / raw)
To: Arundas T C; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]
On 2024-06-03 at 06:28:41, Arundas T C wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> 1. In a remote repository, have a commit that's only in remote at the
> tip of the current branch in local.
> 2. In the local clone of this repository, edit some files and have
> unstaged changes.
> 3. In local, run `git pull --ff-only`.
>
> What did you expect to happen? (Expected behavior)
>
> Fast-forward the local branch to match the remote branch, similar to
> `git merge --ff-only`. Handle any merge conflicts the same way that
> `git merge --ff-only` does.
>
> What happened instead? (Actual behavior)
>
> error: cannot pull with rebase: You have unstaged changes.
> error: Please commit or stash them.
This indicates that you've set pull.rebase, so a `git pull` does a fetch
and a rebase.
> What's different between what you expected and what actually happened?
>
> It errored out because of unstaged changes, even though doing `git
> merge --ff-only` will correctly do what's expected. See below.
>
> Anything else you want to add:
>
> After doing `git fetch`, I can do `git merge --ff-only` and this
> fast-forwards the branch as expected. Isn't `git pull --ff-only`
> basically the same as doing these two (fetch and merge)?
`git merge` doesn't do a rebase. It does a merge, which can sometimes
be done with a dirty tree. `git pull` _normally_ does a fetch and a
merge, but in this case, you've asked it to do a fetch and a rebase,
which has different constraints. The result will almost certainly be
identical (since it's just a fast-forward), but rebases typically don't
allow you to have a dirty working tree.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-03 21:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-03 6:28 git pull --ff-only errors when git merge --ff-only passes Arundas T C
2024-06-03 15:31 ` Junio C Hamano
2024-06-03 21:30 ` brian m. carlson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).