-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.txt
More file actions
43 lines (29 loc) · 988 Bytes
/
Copy pathgit.txt
File metadata and controls
43 lines (29 loc) · 988 Bytes
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
### git pull and overwrite local changes (master branch):
> git fetch --all
> git reset --hard origin/master
### Stage deletion of file or directory, but don't remove local file
> git rm --cached -r somedir
> git rm --cached -r somefile.ex
### Force case insensitivity when rebasing:
> git -c core.ignorecase=true rebase miljoeOgFastholdelse
### View unpushed commits
```
git log origin/<branch>..HEAD
```
```
git diff origin/<branch>..HEAD
```
### Roll back one commit
```
git reset HEAD~
```
### Merge one branch (eg. dev/feature) into another (e.g. master):
# merge master into the development first so that if there are any conflicts,
# they can be resolved in the development branch itself and master remains clean.
# (on branch development)$
> git merge master # (resolve any merge conflicts if there are any)
> git checkout master
> git merge development # (there won't be any conflicts now)
### Get SHA of last commit:
`git log -1 --pretty=%h`
eg.