🤓
Thomas lab
Git&Github
Git&Github
  • Fetching & Pulling
  • Git alias
  • Git & Github : What is in .git ?
  • Git Rebase
  • Git reflog
  • Git Stash
  • Git tags
  • Git Workflow(Collaboration)
  • Quick High-Level
  • Git diff
  • Git installer
  • Reset & Revert commit
  • Github Collaborators
  • Github Basics
  • Introducing Git
  • Merging Branch
  • How to use multiple account
Powered by GitBook
On this page
  • What's Merging Branch ?
  • Merging Made Easy
  • FAST-FORWARD
  • But Not all Merges are fast-forward
  • How to resoling Conflics

Merging Branch

PreviousIntroducing GitNextHow to use multiple account

Last updated 8 months ago

What's Merging Branch ?

Branching makes it super easy to work within self-contained context,But often we want to incorporate changes from one branch into anther !

we can do this using the git merge command

The merge command can sometimes confuse students early on.Remember these two merging concepts :

  • We merge branches , not specific commits

  • We always merge to the current HEAD branch

Merging Made Easy

To merge , follow these basic steps :

  1. Switch to or checkout the branch you want to merge the change into . (the receiving branch)

  2. Use the git merge command to merge changes from a specific branch into the current branch

FAST-FORWARD

In history , we checkout branch FIXBUG in a point and develop a feature . When we done , we merge current branch into master branch . Master branch and ABABA branch beside on point . This called faster-forward

after merging

But Not all Merges are fast-forward

this happen all the time ! Images one of your teammate merge in a new feature or change to master while you were working on a branch

Some Depending on the specific changes your are trying to merge , Git may not be able to automatically merge. This result in merge conflicts , wwhich you need to manually resolve

How to resoling Conflics

Whenever you encounter merge conflicts , follow these steps to resolve them :

step 1 : Open up the file (s) with merge conflicts

step 2 : Edit the file(s) to remove the conflicts . Decide which branch's content you to keep in earch conflict . Or keep the content from both

step 3: Remove the conflicts markers in the document

step 4 : add your changes and then make a commit !