-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_command
More file actions
137 lines (72 loc) · 2.33 KB
/
git_command
File metadata and controls
137 lines (72 loc) · 2.33 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
#init git
#Setting -> search Files.exclude -> remove .git
git init
git status
git add index.html
git commit -m "change detail comment"
#change or config user and email
git config --global user.name xxxxx
git config --global user.email xxxx@xxx.com
#Collaboration
$git init
$git add .
$git commit -m "init git"
#git clone
$git clone https://xxxxxx
#Create a new repository in GitHub
$git remote add origin https://xxxxxx/xxx.git
$git push origin master
#add collaboration
Settings->Collaboration
add user
confirm email
#git ignore
.gitignore
git rm -r --cached
#
copy link repository
mkdir xxxxxx/xxx
cd xxxxxx/xxx
git clone https://xxxxxx/xxx
$ git push origin master
$ git pull origin master
#Working with Branch
$ git branch --set-upstream-to=origin/master master
$ git branch feature-1 # create branch
$ git branch
$ git checkout feature-1 #Switched to branch 'feature-1'
$ git checkout -b feature-2 #create and Switched to a new branch 'feature-2'
$ git branch -D feature-1 #Deleted branch feature-1 (was d4c84e0).
$ git push origin feature-2
$ git pull origin feature-1
$ git checkout --track origin/feature-1 #Switched to a new branch 'feature-1'
#Branch 'feature-1' set up to track remote branch 'feature-1' from 'origin'.
$ git pull origin feature-1
$ git push origin --delete feature-2
To https://github.com/mydevth/githubProject.git
- [deleted] feature-2
$ git checkout master
$ git branch -D feature-1 #Deleted branch feature-1 (was e99453a).
$ git branch -D feature-2 #Deleted branch feature-2 (was 8253e8c).
$ git branch
#Merge Branches
$ git commit -am "add style h1" #add and commit (can't use new file )
#fast forword merge
$ git merge dev
#merge config
$ git merge dev
edit manual
$ git add .
$ git commit
$ git merge --abort #cancle merge
#Rebase
akkad@DESKTOP-Home MINGW64 /e/coding/gitProject/gitProject2 (feature)
$ git rebase master
Successfully rebased and updated refs/heads/feature.
#git warning: LF will be replaced by CRLF in node_modules
$ git config --global core.autocrlf false
----------------------- troubleshooting ------------------
Git fatal: remote origin already exists Solution
$ git remote -v
$ git remote rm origin
$ git remote add origin https://github.com/career_karma_tutorials/git_tutorials