-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit.rmd
68 lines (52 loc) · 1.52 KB
/
git.rmd
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
---
title: "git cheatsheet"
author: Emil Rehnberg
bibliography: refs.bib
csl: shiki.csl
output:
pdf_document:
highlight: zenburn
html_document:
toc_float: TRUE
css: styles.css
---
```{r set-options, echo=FALSE, cache=FALSE}
options(width = 200)
```
```{r echo=FALSE, eval=FALSE}
require(rmarkdown); require(shiny)
rmdFilePath <- "git.rmd"
allexamples <- FALSE
rmarkdown::render(rmdFilePath, output_format="html_document") # "all_document"
```
## 目的
cheatsheet for git. it's a place to dump typical git commands.
## Commands
### history
use `git-reflog`
- to see history including commits.
- Even lost commits that does not show up in `git-log`.
- to reverse `git-reset --hard {glob}`
```sh
git reflog
```
```
dca4f46 HEAD@{0}: reset: moving to dca4f46
efe2d96 HEAD@{1}: reset: moving to efe2d96ef35550ddb4c43b6706e17be439ce179a
dca4f46 HEAD@{2}: rebase -i (finish): returning to refs/heads/master
dca4f46 HEAD@{3}: commit: splits weekend component into two
efe2d96 HEAD@{4}: commit (amend): alters to predict one timeslot per day
ffd9abd HEAD@{5}: reset: moving to HEAD~
a67003b HEAD@{6}: cherry-pick: fast-forward
ffd9abd HEAD@{7}: rebase -i (start): checkout HEAD~5
a67003b HEAD@{8}: rebase: aborting
3094d4d HEAD@{9}: reset: moving to HEAD~
ffd9abd HEAD@{10}: reset: moving to HEAD~
```
### reset credentials on OSX
to reset git credentials (e.g. after password update)
```
git credential-osxkeychain erase
<CR>
```
to erase old credentials, git prompts user again for PW (and doesn't ask for it again)<Paste>