-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_guide.txt
67 lines (51 loc) · 1.56 KB
/
git_guide.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
53
54
55
56
57
58
59
60
61
62
63
64
65
…or create a new repository on the command line
echo "# test_project" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/stevenbinhu21/test_project.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin https://github.com/stevenbinhu21/test_project.git
git push -u origin master
#add submodule:
cd master_repo
git submodule add <remote git repo of the project for submodule>
git commit -m "...."
git push -u origin master
#update submodule
git submodule add <ssh://submodule_url> submodule_dir
git submodule init
# then after sometime, the submodule project changed
cd submodule_dir
# switch to master
git checkout master
# update master
git pull
# back to you submodule project root
cd ..
git commit -am "pulled down update to submodule dir"
# or in loop
git submodule foreach git pull origin master
#branching the project
# create a new branch from master
git clone <master.git url>
cd <that file>
git branch <new_branch_name> master
# switch to the new branch repo
git checkout <new_branch_name>
# do whatever that updates the files, codes etc.
git add <some stuff>
git commit -m "added stuff to new branch repo"
git push origin <new_branch_name>
# then go check github for the new branch
# merge branch to master
# care to do it at the github page?
# no? then do
# switch to master
git checkout master
git merge <new_branch_name>
git push origin master
# might wanna delete the dev branch
git branch -d <new_branch_name>
git push --delete origin <branch_name>