Questions tagged [git-merge]

git-merge is a git command which integrates changes from another branch by incorporating commits into the currently checked-out branch.

A merge in version control is an operation where two sets of changes are combined to have both features available.

Git provides sophisticated merge support by automatically detecting simple merges (i.e. if only changes on one branch happened, also called fast-forward) and allowing plugable merge-strategies for more advanced use-cases.

3320 questions
1
vote
1 answer

How do I resolve merge conflicts in case of evil merges?

How to resolve merge conflicts in a git repo in case of evil merges. When we want to resolve conflicts merge we have 4 options: Accept current change Accept incoming change Accept both changes Do it manually But in real projects,we need to add new…
Youness
  • 11
  • 2
1
vote
1 answer

issue after merging with wrong branch

My local branch is gen-1000. I first merged Release_1 into gen-1000. There is some conflict in the pom.xml. I chose to use theirs(Release_1). After that, I modified pom.xml. I wanted to merge Release_1 into gen-1000 again and use my pom to mark it…
Abe
  • 310
  • 3
  • 15
1
vote
1 answer

git merge command renames the file to original value

I must be doing something wrong. There are 2 branches, develop and feature. I decided to start feature branch and implement some radical changes. This includes renaming the files (changing file name and path) and content inside. Content change…
unalignedmemoryaccess
  • 7,246
  • 2
  • 25
  • 40
1
vote
1 answer

Git merge doesn't update locally

I have a git issue with merging master into my branch. git checkout master git fetch origin git pull git checkout my-branch git merge master Outputs: Already up to date. However, locally I can see changes between the two branches. When I try to…
Suki
  • 177
  • 3
  • 12
1
vote
3 answers

Is there a difference between "git merge" and "git checkout -b"?

https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches I would like to confirm that at the end of the "Pushing" section on the above page, (1) Execute git merge origin/serverfix after fetch (2) Run git checkout -b serverfix origin/serverfix Am…
森口万太郎
  • 805
  • 6
  • 20
1
vote
3 answers

How to not overwrite database information in a Git merge

I have a CRUD app that will be used to track trucking appointments. I'm ready to deploy the app, but I'm worried about merging a future branch into the main branch without overwriting the existing information in the database. How can I use CLI git…
Brandon
  • 117
  • 7
1
vote
1 answer

Git merge says already up-to-date with master but my branch doesn’t contain the latest changes

I’m working on a branch “ABC” cloned from master and since someone’s changes just got merged to master branch my code needs their latests changes. I used git merge and sent everything in a new commit, However, when I use hit pull, git merge, and…
BillyRoca
  • 25
  • 5
1
vote
1 answer

one repo cloned in two places on git bash

i mistakenly cloned a repo in two different folders on git bash one is located on the root folder while the other is in a folder I created, now all my recent commits and push doesn't show up on the one on the root folder even though both of them are…
1
vote
1 answer

How can I see the actual line or word level differences when viewing merge conflicts in VS Code

If "git merge .." results in a conflict, I can open the conflicted file in VS Code and see the diffs surrounded by <<<<<. ======, and >>>>> etc. But what I want to see are the actual differences between the two sections separated by =====, in the…
Motorhead
  • 928
  • 6
  • 16
1
vote
3 answers

Get MERGE_HEAD in pre-merge-commit hook

In pre-merge-commit, I need the hash of the merge head to verify a few things about the commits that are about to be merged to the current branch. However, it seems that neither the reference MERGE_HEAD nor the file .git/MERGE_HEAD exist at the time…
Piotr Siupa
  • 3,929
  • 2
  • 29
  • 65
1
vote
2 answers

Git failed to push some refs due to large file though the large file isn't tracked and not on the local system

I want to sync my local changes to the GitHub master repo online. I originally had a file over 100 MB but since added it to the .gitignore file. I moved the large file to another, untracked non-Git folder. $ git status On branch master Your branch…
cona
  • 169
  • 1
  • 13
1
vote
0 answers

Can the Git `merge` command reveal conflicts in non-UTF-8 encoded files?

I am getting familiar with how the merge command works and came upon the following unexpected case. I noticed that trying to merge two commits, both of which edited a UTF-16 encoded file, Git failed to point out the changes made on both branches…
Kaloyan
  • 41
  • 1
  • 6
1
vote
2 answers

Git rebase vs merge after rebase master on feature branch

I'm learning about rebase and saw a workflow of doing a rebase on a feature branch and then merging it into master (as an example): git checkout feature git rebase master git checkout master git merge feature However I saw another similar option of…
sir-haver
  • 3,096
  • 7
  • 41
  • 85
1
vote
0 answers

Is it possible to remove/ignore Pull request merges during git filter-repo? How do it do it?

I am trying to move a folder from RepoA into RepoB with git and file histories. Using git filter-repo for the purpose as below git filter-repo --path src/test However doing so includes all the Pull Request Merge commits along with fix commits like…
Britto
  • 501
  • 1
  • 9
  • 22
1
vote
1 answer

Azure Devops pull request update content after reject

We are working with Azure Devops, merge into main only via PR. If the QA team reject the PR because of some bug in the code, and the developer fixed the bug - do we have to open a new PR? Can we not update the code on the current PR and re-submit…