-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setting_up_local_repository_on_remote
103 lines (81 loc) · 2.53 KB
/
Setting_up_local_repository_on_remote
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
cd project_name
cat .git/config # check for remote URL
'''
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = REPLACE_WITH_YOUR_URL
fetch = +refs/heads/*:refs/remotes/origin/*
'''
# Change remote url with username url
git remote
origin
# Remove origin
git remote rm origin
# Add remote url
git remote add origin https://github.com/username/demo_repo.git
# Add feature_branch to remote url
git push origin master
# First version
# To create & track new feature branches
git branch
* master
git checkout -b feature_branch_1
git push -u origin feature_branch_1 # add & track feature_branch_1 to remote
git branch
* feature_branch_1
master
git checkout master
git branch
* master
feature_branch_1
git checkout -b feature_branch_2
git push -u origin feature_branch_2 # add & track feature_branch_2 to remote
git branch
feature_branch_1
* feature_branch_2
master
cat .git/config # check if the new feauture branches are tracked
'''
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/username/demo_repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "feature_branch_1"]
remote = origin
merge = refs/heads/feature_branch_1
[branch "feature_branch_2"]
remote = origin
merge = refs/heads/feature_branch_2
'''
# To untrack remote branches
git branch --unset-upstream feature_branch_1
git branch --unset-upstream feature_branch_2
# Second version
# To create & track new feature branches
git branch
* master
git branch -u origin/master master
git branch -u origin/feature_branch_1 feature_branch_1
git branch -u origin/feature_branch_2 feature_branch_2
git push origin master
git push origin feature_branch_1
git push origin feature_branch_2
cat .git/config # check if the new feauture branches are tracked
# To untrack remote branches
git branch --unset-upstream feature_branch_1
git branch --unset-upstream feature_branch_2