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.

  • Why does git store objects in directories with the first two characters of the hash?
  • Stash only one file out of multiple files that have changed with Git?
  • git temporary unset of http.proxy
  • GIT Pull & Clone times out
  • Disable automatic commit of changed files in Visual Studio 2013 to git
  • Push from github to heroku without downloading repo
  • 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.

    Update

    git merge -s ours BRANCH_NAME worked for me.

  • Managing big project using single entity model
  • git ignore specific directories
  • Using 'git remote add origin' creates a global remote instead of one local to current directory/repo
  • How to rebase a branch and its descendant?
  • How can I run recursive find and replace operations on multiple files in parallel?
  • what does subproject commit mean?
  • 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.