Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchen committed Mar 13, 2024
1 parent 4c2bc0a commit fa6e214
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/document/Git/docs/Git Cheatsheet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Git cheat sheet

## History

## Branching

### Branch manipulation
Expand All @@ -22,7 +24,7 @@
|show diff between two branches|`git diff [--name-only\|--name-status] <branch_from>..<branch_to>`|
|show diff between current branch to target branch|`git diff [--name-only\|--name-status] <target_branch>`|

## Stashing
### Stashing

|usage|command|
|---|---|
Expand All @@ -34,7 +36,7 @@
|delete stash|`git stash drop stash@{<index>}\|<index>`|
|delete all stash|`git stash clear`|

## Merging
### Merging

|usage|command|
|---|---|
Expand All @@ -48,7 +50,7 @@
|undo merge if history shared|`git revert -m <parent-number> HEAD`|
|merger branch as squashed to current branch|`git merge --squash <branch>`|

## Rebasing
### Rebasing

:::Warning
Rebasing rewrites history, use it only in local.
Expand All @@ -61,14 +63,16 @@ Rebasing rewrites history, use it only in local.
|continue rebasing if conflicts are resolved|`git rebase --continue`|
|disable rebasing backup|`git config [--global] mergetool.keepBackup false`|

## Cherry-picking
### Cherry-picking

|usage|command|
|---|---|
|pick one commit into current branch|`git cherry-pick <commit_hash>`|

## Picking a file from branch
### Picking a file from branch

|usage|command|
|---|---|
|pick file from another branch to current|`git restore --source=<branch> -- <filename>`|

## Collaboration

0 comments on commit fa6e214

Please sign in to comment.