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
| # Reverting changes
git reset --hard/--soft [commit|branch|ref]
git checkout simplefile.txt
git reset . # undo changes and undo `git add`
git reset --soft HEAD~1 # undo last commit
# remove commit from git
git revert --strategy resolve <commit>
# set upstream
git branch --set-upstream dev origin/remoteBranchName
# Merging
git merge -X theirs branchName
git merge -X yours branchName
# Stashing
git stash
git stash list
git stash pop
git stash apply stash@{0}
# Tagging
git tag nameTag <SHA-1>
git tag nameTag branchName
git tag nameTag other tag
git tag nameTag HEAD^
# Patchs
git diff > thediff.patch
git apply -v thediff.patch
# Git diff clean
git diff -U0 | grep '^[+-]' | grep -Ev '^(--- a/|\+\+\+ b/)' | sed -r "s/^([^-+ ]*)[-+ ]/\\1/"
# Logs and diff
git log --pretty="%h on %ad by %ae => %s" --date=short origin/master
git log --author=darvein@gmail.com --pretty=format:"%h%x09%an%x09%ad%x09%s"
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --author="Dennis Ruiz"
git-log --graph --online
git log --name-status
git log --name-only
git log --stat
git log <nombre_de_un_branch>..<otro_branch>
git show --pretty="format:" --name-only [aqui el id de un commit]
git log --online --decorate --graph
# Using git subtree
git remote add -f -t master --no-tags gitgit [https://github.com/git/git.git](https://github.com/git/git.git)
git subtree add --squash --prefix=third_party/git gitgit/master
git subtree pull --squash --prefix=third_party/git gitgit/master
git subtree push --squash --prefix=third_party/git gitgit/master
# Search a text in all the branches
git log -Stext_to_search --source --all
git config core.filemode false
# Remove a directoryfrom the whole repo
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch NOMBRE_DE_LA_CARPETA_O_ARCHIVO" HEAD
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
git push -f origin master
|