gitgithubgitlab

Git merge compare from to meaning


I wonder for the git Compare View's from and to fields, when a 'Merge Request' is made, is the merge is made so that, the branch in from will be merge into the to? or vise versa? I do not want to trigger the request without understand the concept of it.

I have two branches one is feature, another is develop. I wonder should I put the feature in the from field and compare develop in to field in this case?


Solution

  • When you run a merge, the "from" is typically the source branch, and the "to" would be the destination branch where the replays will take place.

    $ git checkout destination-branch
    
    $ git merge source-branch
    

    In this case, you would be merging the changes from source-branch to destination-branch.

    If you think of from as the "source branch", and to as the "destination" branch, that should be a common workflow as above you can transfer to git clients and remotes.