-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitcommands.txt
More file actions
54 lines (27 loc) · 1.48 KB
/
gitcommands.txt
File metadata and controls
54 lines (27 loc) · 1.48 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
git init --> initialize a repository
git status --> check status of git repo
git add <file_name> --> add file to git repo i.e. let git register the file
git commit --> commit the changes
git commit -m '<commit msg>' --> one line commit with commit msg in terminal itself
git add . --> add all files at once
touch .gitignore --> create .gitignore file in windows so that we can edit it. gitignore file holds files which git should ignore
git branch <branch_name> --> create new branch
git checkout <branch_name> --> switch to new branch
git checkout master --> switch to master branch
git merge <branch_name> --> merge branch to master
git stash --> stash the changes
git stash apply --> apply stashed changes
git remote --> lists all remote repository
git clone <repo_url.git> --> clone repo into local
git remote -v --> lists git repo urls
git fetch origin --> Pull all recent changes to local from remote
git pull origin --> Pull and merge all recent changes to local from remote
git pull origin master --> Pull and merge all recent changes to local from remote
git commit -a -m '<commit msg>'
git push origin master --> Push to remote repo
git remote add <repo_name> <repo_url> --> Add other remote repositories
git config --list --> Lists all credential data
git config --global --list --> Lists user data
git config user.name <new user_name> --> update user_name
git config user.email <new user_email> --> update user_email
git config user.pswd <new user_pswd> --> update user_pswd