-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerging_branches.txt
52 lines (46 loc) · 2.47 KB
/
merging_branches.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Types of Merges :
===============
Fast forward Merge | This merge is possible when there are no further commits in the receiving branch (MAIN/MASTER)
after the commit where the feature branch is created
Three-way Merge |
----------------------------------------------------------------------------------------------
Steps for Fast-forward Merge :
1. Checkout the MASTER branch
2. Choose which branch you want to merge to MASTER
3. If the Fast-forward merge is done, the pointer of (MASTER + HEAD) is moved from MASTER branch to FEATURE branch
4. After merging , DELETE the feature branch
----------------------------------------------------------------------------------------------
It moves the branch pointer from one commit to another commit
----------------------------------------------------------------------------------------------
MERGING PROCESS
===============
1. Create a new feature branch from the main branch
2. Make changes in the new branch and commit
3. Checkout main branch (receiving branch)
4. Merge feature branch to the currrent receiving branch
git merge <feature-branch>
3-way merge: MC - Master Commit, FC -> FEATURE branch commit
===========
HEAD
|
Ancestor MASTER
| |
MC1 -> MC2 -> MC3 ->MC4 -> MC5 ->New Merge Commit
^ |
| |
FC1 -> FC2 -> FC3 <-|
Suppose there are a total of 5 commits in MASTER.
The FEATURE branch was created from the MASTER after the 3rd commit.
So there are 2 more commits after the feature branch was developed.
The place from where the feature branch was created is called Ancestor(This is in MASTER branch)
Assume 3 commits are made in the FEATURE branch.
There will be a new MERGE Commit created after the last commit in MASTER.
It will also point to last commit of FEATURE branch
Then the feature branch can be created
-------------------------------------------------------------------------------------------------------
Merge Conflicts : Same files were edited in different branches
It happens when there are additional changes in the receiving branch after creating the FEATURE BRANCH.
===============
When a MERGE CONFLICT happens, then the STAGING AREA has the changes which were in MASTER BRANCH and FEATURE BRANCH
CTRL +K = Used to delete lines in NANO EDITOR
Bitbucket is another repository hosting service like GITHUB