-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.txt
49 lines (29 loc) · 1.51 KB
/
git.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
Staging:
git add <filename> - adds a file to the repo.
git add . - adds all untracked files and changed to the staging area
Commiting:
git commit -m <message> - commits all changes in the staging area to the project and lets you add a message directly.
git commit -a - commits all changes of all tracked files without staging.
Reviewing:
git status - review current project status.
git log - logs all commits that were made to the branch.
git branch - lists all branches in current repo.
git checkout - checks out a branch or version of the project.
git diff <hash/branch> <hash/branch> - diffs between 2 versions or branches.
git remote - lists all remote repos connected.
Branching:
git branch <branch_name> - adds a new branch to the project
git checkout -b <branch_name> - same as above but also switches to the new branch.
git branch -D <branch_name> - deletes the named branch.
Merging:
git merge <branch_name> - merges named branch to current branch.
git checkout <branch_name> <file_name> - copy file from one branch to the current branch.
Remotes:
git clone <src> <dir> - clones a reomte repo to local dir
git remote add <remote_name> <src> - add a source to repo.
git remote rm <remote_name> <src> - remove a source from repo.
git push - pushes the changes to remote
git push <remote_name> <branch_name> - pushes a new branch to remote
git pull <remote_name> <branch_name> - pull the specified branch from remote
Tools:
git-flow - a tool to help manage projects