Catalogue
Git Command Cheat Sheet

Git Command Cheat Sheet

🌐 日本語で読む
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
// Check out the remote origin/develop into a local develop branch
git checkout -b develop origin/develop

// Discard edits to a specific file. Restore it to its committed state.
git checkout <filepath>

// List commits
git log
git log --pretty=oneline

// Undo the most recent commit
git commit --amend

// Throw away the commit entirely.
git reset --hard HEAD

// Unstage a file that was added to the index
git reset (file_name)

// Throw away the last n commits.
git reset --hard HEAD~{n}
// Undo a push. (Remove the commit info on the remote)
git push -f origin HEAD

// List tags
git tag -n
// Create a tag
git tag -am "<message>" <tag_name>
// Delete a tag
git tag -d <tag_name>


// Stash work-in-progress files
git stash
// Pop the stashed files back out
git stash pop
kenzo0107

kenzo0107