-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit learning
More file actions
51 lines (41 loc) · 1.55 KB
/
Copy pathgit learning
File metadata and controls
51 lines (41 loc) · 1.55 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
Learn Git from LiaoXuefeng: (# means note here)
Creat Reposity:
first,Creat a new folder:
$ mkdir dirname
$ cd dirname
second,Change the folder to a repository of Git:
$ git init
ls -ah #there is a folder named .git
then,create a file under the folder you have turn into a repository,
and next,hand in the file into repository:
$ git add filename #hand into Working Directory
$ git add -f foldername
$ git commit -m "explain" #hand into Repository
$ git status #show repository's state
$ git diff #show changes
$ git log #show each hand in
$ git reset --hard HEAD/commit_ID #back to last version/history version,,HEAD means current version
$ git reflog #show history command
if you want to hand into Repository,you must be sure it has been in Working Directory already.
$ git checkout --file #abondon the change in Working Directory
$ git reset HEAD file #anondon the change in Repository back to Working Direcotory
Remove file:
first,
$ rm filename
then,
$ git rm filename #confirm to delete
Add to Github:
fitst, login Github ,find "Create a new repo" and fill in the "Repository name",click "Create repository"
then,
$ git remote add origin git@github.com:txAnnie/name.git #connect a repository
$ git push origin master #first time:" $ git push -u origin master"
******if you failed to remote :
$ git remote rm origin
then
$ git remote add origin git@github.com:txAnnie/name.git
if you failed to push:
$ git pull origin master
then,
$ git push origin master******
Clone from Github:
$ git clone git@github.com:txAnnie/name.git