get_started_with_git.md 977 Bytes
Newer Older
Sabina Köfler's avatar
Sabina Köfler committed
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
71
72
73
74
75
76
# Learn how to use git

## check your local working directory for changes

```
git status
```

## if 'nothing to commit, working tree clean' get the changes from remote repository

```
git pull origin master (or main)
```

## if you want to start fresh from the remote repo

```
git reset --hard origin/master (or origin/main)
```
<https://stackoverflow.com/a/38784578>

## work now! after you have made changes

```
git add [specify filename]
```

or add ALL

```
git add .
```

## work some more! if done

```
git add . (optional)
```

```
git commit -m "Write message"
```

## see the difference you made

```
git diff origin main
```

## send your changes to the remote repository

```
git push
```

## if someone has changed something in the meantime you will get notified

```
git pull
```

then

```
git push
```

## automatically close an open issue when pushing a commit

```
git commit -m "Sort more efficiently" -m "Closes #[INSERT_ISSUE_NO]]"
```

```
git push
```