Difference between Git fetch and Git pull: Error: You have not concluded your merge (MERGE_HEAD exists)
The difference between FETCH and pull is that you can fetch the latest version from remote to local
1. Fetch: only fetch the latest version from remote to local, not merge
(merge)
git fetch origin master //Get the latest version on the origin/master branch from the master master branch on a remote origin.
git log -p master..origin/master //Compare the difference between a local master branch and an origin/master branch.
git merge origin/master //consolidation
2. Pull: get the latest version remotely and merge
(merge) locally
git pull origin master //This is equivalent to doing a git fetch and a git merge.
In practice, it may be better to git fetch
, because before merge
, it can be decided whether to merge
according to the actual situation
Besides, it causes error: error: You have not concluded your merge (MERGE_HEAD exists).
may be caused by the failure of automatically merging the code pulled down before
Solution 1: keep the local changes and abort the merge -& GT; Re-amalgamate -& GT; To pull
git merge --abort //Termination of pooling
git reset --merge //re-merger
git pull //refetch
Solution 2: Abandon the local code, and the remote version overwrites the local version (careful)
git fetch --all
git reset --hard origin/master
git fetch
Read More:
- You have not concluded your merge (MERGE_HEAD exists)
- Please specify which branch you want to merge with
- Git solves pull origin error: the following untracked working tree files would be rewritten by merge
- Fatal: reusing to merge unrelated histories
- Resolving fatal: reusing to merge unrelated histories in Git
- fatal: refusing to merge unrelated histories
- [FAQ] after git merge, the push to Gerrit fails, indicating no new changes?
- Error: your local changes to the following files would be rewritten by merge solution
- Android dependency merge rules
- error: Your local changes to the following files would be overwritten by merge
- 21. Merge Two Sorted Lists [easy] (Python)
- Mac Windows partition merge and delete
- LeetCode 23. Merge k Sorted Lists(java)
- How to turn off merge request in gitlab
- error: The following untracked working tree files would be overwritten by merge
- Android Cannot merge new index 67208 into a non-jumbo instruction
- Pull is not possible because you have unmerged files. Please, fix them up in the work tree, and then
- How to solve the problem of “please enter a commit message to explain why this merge is necessary” when git merges branches?
- Array of PHP_ diff,array_ intersect,array_ merge, in_ Is there a limit on the number of arrays in array?
- Pull is not possible because you have unmerged files