-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGitCommands
70 lines (66 loc) · 1.58 KB
/
GitCommands
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
// create a directory
mkdir dir-repo
cd dir-repo
// initialize it to local repo
// turn a directory into an empty git repo
git init
// create new file
touch file1
// add the file to staging area
git add fileName
//or add all files in directory to stagingarea
git add .
// show which file need to be commited
git status
// commit file
git commit -m "first commit"
// use git config to play with settings
// git config local to current repo
git config user.name "UserName"
git config user.email "UserEmail"
//git config global
git config --global user.name "UserName"
git config --global user.email "UserEmail"
// how to see all branches
git branch
// create a branch
git branch newfeature
//got in branch
git checkout newfeature
// create a branch and go in it
git checkout -b newfeature
//got to master then merge
git checkout master
git merge newfeature
//delete branch
git branch -d newfeature
//git a local repo from remote repo
mkdir cloneRepo
cd cloneRepo
git clone Linke of repo
// create a new remote repo in your github account
// take link of that repo
// add your remote to your local
// connect local to remote
git remote add origin " link of remote repo "
// add what in your remote repo to your local
git pull origin master
// add what in your local repo to your remote repo
git push origin master
// use stash command to save changes needed to commit
git touch file
git status
git stash -u
git status
git stash list
git stash show
git stash apply
// show all commit
git log
// revert commit
git log --oneline
git revert "hash"
//then vicevers
git revert Head
//
git rebase master