Git Commands

studied byStudied by 7 people
5.0(1)
Get a hint
Hint

start a git repo from scratch

1 / 39

flashcard set

Earn XP

Description and Tags

40 Terms

1

start a git repo from scratch

$ mkdir my_project

$ cd my_project

$ git init

New cards
2

clone a repo

$ git clone path_to_repo

New cards
3

see hidden directory with repo info

$ ls -a

New cards
4

set up git name

$ git config --global user.name your-name

New cards
5

set up git email

$ git config --global user.email your-email

New cards
6

add a file

$ git add file

New cards
7

unstage a file

$ git reset

New cards
8

commit a file

$ git commit -m “commit text”

New cards
9

revert stage

$ git checkout

New cards
10

revert push

$ git checkout HEAD

New cards
11

verschil voor en na stage

$ git diff

New cards
12

verschil voor en na push

$ git diff HEAD

New cards
13

see status / current branch

$ git status

New cards
14

check commit history

$ git log

New cards
15

discard working directory file changes

$ git checkout -- filename

New cards
16

discard all changes in working directory

$ git checkout .

New cards
17

retrieve file from specific commit into stage

$git checkout commit-id filename

New cards
18

check who edited what

git blame filename

New cards
19

show branches and the commit it points to

$ git branch -v

New cards
20

commit log

git log

New cards
21

commit log and show commit summary in one line

git log --oneline

New cards
22

commit log and add branch info

git log --decorate

New cards
23

commit log and include all branches

git log --all

New cards
24

switch to another branch

git checkout otherBranch

New cards
25

what happens when you switch to another branch?

points head to named branch and updates directory

New cards
26

show branches

$ git branch

New cards
27

what does $ git branch do?

it returns branches and puts a * in front of the current branch

New cards
28

create new branch

$ git branch name

New cards
29

create and select new branch

$ git checkout -b name

New cards
30

merge the work on “name” back into master

$ git checkout master

$ git merge name

New cards
31

delete branches

$ git branch -d name

New cards
32

finish merge after conflict

$ git add file

$ git commit

New cards
33

go back after merge conflict

$ git merge --abort

New cards
34

add remote

$ git remote add name id

New cards
35

add reference to repo on remote machine with ‘name’

$ git remote -v

New cards
36

send local commits to remote

$ git push

New cards
37

update our knowledge of the remote

$ git fetch

New cards
38

use remote commits

$ git merge

New cards
39

shortcut for fetch & merge

$ git pull

New cards
40

create local clone

$ git clone link

New cards

Explore top notes

note Note
studied byStudied by 34 people
... ago
5.0(1)
note Note
studied byStudied by 120 people
... ago
5.0(3)
note Note
studied byStudied by 12 people
... ago
5.0(1)
note Note
studied byStudied by 5 people
... ago
5.0(1)
note Note
studied byStudied by 49 people
... ago
5.0(2)
note Note
studied byStudied by 5 people
... ago
5.0(1)
note Note
studied byStudied by 4517 people
... ago
4.7(11)

Explore top flashcards

flashcards Flashcard (32)
studied byStudied by 245 people
... ago
5.0(3)
flashcards Flashcard (175)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (257)
studied byStudied by 32 people
... ago
5.0(1)
flashcards Flashcard (48)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (25)
studied byStudied by 14 people
... ago
5.0(1)
flashcards Flashcard (41)
studied byStudied by 65 people
... ago
5.0(1)
flashcards Flashcard (32)
studied byStudied by 6 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 51 people
... ago
5.0(2)
robot