GIT: how to merge two branches without actually merging files (trivial merge)

Is there a way in git to merge two branches without merging file? In other words just to draw the merge arrow.

Let say I have branches A and B. I need to merge branch B to A, but no need all the changes in B, but rather only need to link to branches together.

  • git to ignore a hidden directory in the local repo
  • How to make sure others people cannot edit my git notes?
  • Use Git LFS with TFS 2015 Update 2 OnPremise
  • How can I have git ignore local changes to a specific file, without modifying the .gitignore?
  • Unable to connect to bitbucket using git from jenkins from tomcat installation in windows
  • How to find commits by a specific user in Git?
  • git checkout A
    git merge B --no need changes

    In general is there a way to merge two branches without submodules. I want to keep submodules as it is in Branch A and still need to merge branch B.


    git merge -s ours BRANCH_NAME worked for me.

  • Use Git with existing files and update branch after push
  • Git - Automatically track all files in a directory
  • Force git show to show diff using vimdiff
  • Why is EC2 not pulling updates from bitbucket/github via post-receive hook?
  • laravel 4 installation problems
  • Repositories of conda recipes and packages
  • 2 Solutions collect form web for “GIT: how to merge two branches without actually merging files (trivial merge)”

    Use git merge -s ours B to perform a merge discarding any changes B would introduce. Still, the commits from B are now in A, however, the files are at the state of A before the merge.

    You can do a real merge and run git reset ORIG_HEAD --hard to go back.

    If you just want to have a try or study what happens after git merge, you could make a series empty commits by git commit --allow-empty --allow-empty-message --no-edit for several times. After you create the commits and branches, you can run git merge and use gitk or git log --oneline --graph to see the commit graphic.

    Git Baby is a git and github fan, let's start git clone.