-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathgit-branches
More file actions
156 lines (72 loc) · 3.06 KB
/
git-branches
File metadata and controls
156 lines (72 loc) · 3.06 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Agenda
-------------------------
-------------------------
Branches in Git
----------------------
Git Merge
----------------------
Git Fetch
---------------------
Git pull
---------------------
Merge Conflicts in Git
----------------------
--------------------------
--------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Branching Strategy in Git/ How Branching works
-------------------------------------------------
Main/Master Branch --- Here we store code that is being pushed to production server
live environment ---- served by the code that is available in master branch
New features will be added to the product, which means new code will be addd to the existing code
Feature ---> Prouduct
Master Branch – cworking code (existing code) + code for a new feature
code for a new feature might result in issues, Resulting in application down time
-----------------------------------------------------
Master Branch – previous working code is already there
we’ll create a new Branch
New Branch --- NEW code --- Testing the code on the new branch
Merge----New Branch + Master Branch
Master Branch = Has the latest code
4 Developers are there in a team
Each developer will be working on an individual features
Each developer will their own feature branch
The tickets are assigned using a jira tool
-----------------------------------------------
feature-123658-- Add caching mechanism
feature 123659 – add a filter in front end
feature-123658 --- this will the branch name created by the developer and starts working on this
feature-123658 – add the new code
merge this code master branch
How to create Branches
------------------------------
git branch branch_name
ex: git branch feature-123658
how to get / checkout in to particular branch
git checkout branch_name
ex: git checkout feature-123658
-------------------------------------------------------------------------------------------------------------
Inorder to create a branch and checkout to the branch, we can use a single command as well
git checkout -b branch_name
How to merge
---------------------------------
git branch
---> it will point out the current branch
*feature-123658
I will switch to the master branch
git switch branchname
git switch master
switch to master branch
merge feature-123658 to master branch
git merge feature-123658
this will merge the code from feature-123658 branch to the master branch
------------------------------
Branch will always points to latest commits
------------------------------------------
Git fetch – will pull the latest code from the remote repository to the local repostory
but it will not merge the code to our working branch
git merge
------------------
to merge this code to our current branch we need to use git merge, the the changes are reflected in our current branch
git pull ----> it will fetch the code + it will also merge the code
git pull ---> git fetch + git merge