GIT diff gives me a different feedback than GIT merge

when i run

git diff FETCH_HEAD

it displays the download of the expected changes, since I downloaded the updated version from my remote.

BUT....

when i run

git merge FETCH_HEAD

he tells me that everyone is in the know!

Where am I going wrong?

+3
source share
1 answer

Why FETCH_HEADis it different from HEADafter the merger?

Merging creates a new commit containing all the changes from the original HEAD, now ORIG_HEADand FETCH_HEAD. This means that if your original ones HEADcontained changes not contained in FETCH_HEAD, then the new (merged) HEADwill be different FETCH_HEAD, since it contains these commits.

Thing to check

, ​​ FETCH_HEAD .

, sha ( ) :

git log -1 FETCH_HEAD
commit bec5aadef68a5d29c9d523358a0189b86cad4c82
Author: Alex Brown <alex@XXX>
Date:   Tue Nov 16 10:05:19 2010 +0000

    weather report

6 FETCH_HEAD: bec5aa

, sha

git log HEAD | grep "commit bec5aa" -A 5

commit bec5aadef68a5d29c9d523358a0189b86cad4c82
Author: Alex Brown <alex@XXX>
Date:   Tue Nov 16 10:05:19 2010 +0000

    weather report

-, , FETCH_HEAD . , , HEAD, HEAD ( ).

* "

cd /tmp
mkdir 1
cd 1
git init
echo "Woo" > a.txt
git add a.txt 
git commit -m "first commit"
cd ..
git clone 1 2
cd 1
echo "Its nice today" >> a.txt
git commit -a -m "weather report"
cd ..
ls
cd 2
ls
echo "Like peas in a pod" > b.txt
git add b.txt 
git commit -m "sayings"
git fetch
git diff FETCH_HEAD
git merge FETCH_HEAD
git diff FETCH_HEAD
+2

Source: https://habr.com/ru/post/1775153/


All Articles