Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* Bug/Weird behaviour with git pull
@ 2023-04-17 10:34 Berat Özdemir
  2023-04-17 11:19 ` Kristoffer Haugsbakk
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Berat Özdemir @ 2023-04-17 10:34 UTC (permalink / raw
  To: git@vger.kernel.org

Hi there,

I stumbled on a weird behavior in git with the pull operation. 
Imagine the following scenario:

We have a local and a remote repository, with the branches master, develop and f1. We

- cloned the remote repository. 
- checked f1 out
- checked develop out
- run git merge f1. Merge was successful. 
- Did not pushed
- run git reset --hard origin/develop -> to undo the f1 merge into develop
- run git pull origin f1

What did you expect to happen? (Expected behavior)
I expected that "git pull origin f1" will just update the f1 branch (fetching and merging with origin/f1). In my case I expected nothing to happen since neither local f1 nor origin/f1 did changed while testing. Just develop changed locally, but it was resetted.

What happened instead? (Actual behavior)
"git pull origin f1" created a new commit, which was the previously resetted merge into the develop branch.

What's different between what you expected and what actually happened?

I expected nothing to happen  (or if remote f1 changed, that those changes would be present locally) but I got the previously resetted merge into develop redone 

Anything else you want to add:

We use git with one remote repository with a master branch, a develop branch and a lot of feature branches.
I was about to write a script, which determines candidate feature-branches, which should be automatically merged into the develop branch.

Our merge-workflow is as follows:

1. Update local repository (pull develop, pull the feature-branch which should be merged)
2. Merge
3. Push

While testing my script, I did not pushed at all, since I didn't want to publish some weird testing stuff to the remote. Therefore every merge I did was locally.


What did you do before the bug happened? (Steps to reproduce your issue)

I pulled develop and feature f1. Then I switched to the develop branch and run "git merge --no-ff f1". The merge was successful. Now I changed my script (git-irrelevant things, like transitioning the corresponding ticket) and wanted to test the script again. To do this I wanted to undo the merge and did a hard reset on the local develop branch to the origin/develop commit. Everything was okay until I ran the script again - it reported that there was already a merge. I checked the git tree - and there it was. I repeated the process with resetting the develop branch and explicitly commented the "git merge" part out of my script. But after running the script, the merge was there again. After trying around I found out, that the "git pull origin f1" command redoes the resetted merge into develop. On the remote nothing changed while I was testing - so I don't get why git pull does anything at all.
 
I thought, the pull command fetches new commits from the remote and merges tracked remote branch into the local tracking branch.


[System Info]
git version:
git version 2.38.1.windows.1
cpu: x86_64
built from commit: b85c8f604d375d4d773a36842964e8a7ec056aae
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 19045
compiler info: gnuc: 12.2
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>


Mit freundlichen Grüßen
​Kind regards
Berat Özdemir
IT Software Entwicklung
Phone:+49 201 8676  14402
Berat_Oezdemir@deichmann.com
www.deichmann.com
​Deichmann SE, Deichmannweg 9, D-45359 Essen
 
Sitz der Gesellschaft: Essen, Registergericht Essen HRB 21020, USt.-ID-Nr.: DE 119 663 402
Vorsitzender des Verwaltungsrats und der geschäftsführenden Direktoren: Heinrich Otto Deichmann
Geschäftsführende Direktoren:
Alexander Bellin * Samuel Deichmann * Martin Fischer * Dr. Lars Jendrian * Manfred Kroneder

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-17 17:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 10:34 Bug/Weird behaviour with git pull Berat Özdemir
2023-04-17 11:19 ` Kristoffer Haugsbakk
2023-04-17 11:57   ` AW: " Berat Özdemir
2023-04-17 12:49 ` Felipe Contreras
     [not found]   ` <AS8P194MB157593E9D310D6B03A1E0577E29C9@AS8P194MB1575.EURP194.PROD.OUTLOOK.COM>
     [not found]     ` <AS8P194MB157539251684168156C0EC99E29C9@AS8P194MB1575.EURP194.PROD.OUTLOOK.COM>
2023-04-17 16:21       ` Felipe Contreras
2023-04-17 17:08 ` Junio C Hamano

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 read-only IMAP folder(s) and NNTP newsgroup(s).