77 lines
778 B
Markdown
77 lines
778 B
Markdown
|
---
|
||
|
title: Git
|
||
|
tags: note software git
|
||
|
created: 2023-07-01T08:52:17Z
|
||
|
published: true
|
||
|
---
|
||
|
|
||
|
## git
|
||
|
|
||
|
### Delete branch
|
||
|
|
||
|
```bash
|
||
|
git branch -d $branch
|
||
|
```
|
||
|
|
||
|
### Delete remote branch
|
||
|
|
||
|
```bash
|
||
|
git push origin --delete $branch
|
||
|
```
|
||
|
|
||
|
### Push branch to remote
|
||
|
|
||
|
```bash
|
||
|
git push -u origin $branch
|
||
|
```
|
||
|
|
||
|
### Rebase preserving dates
|
||
|
|
||
|
```bash
|
||
|
git rebase -i --root --committer-date-is-author-date
|
||
|
```
|
||
|
|
||
|
### Rename branch
|
||
|
|
||
|
```bash
|
||
|
git branch -m $old $new
|
||
|
```
|
||
|
|
||
|
### Sign last commit
|
||
|
|
||
|
```bash
|
||
|
git commit --amend --no-edit -S
|
||
|
```
|
||
|
|
||
|
### Show log
|
||
|
|
||
|
```bash
|
||
|
git log --oneline
|
||
|
```
|
||
|
|
||
|
### Show remote
|
||
|
|
||
|
```bash
|
||
|
git remote -v
|
||
|
```
|
||
|
|
||
|
### Undo `git add`
|
||
|
|
||
|
```bash
|
||
|
git reset $file
|
||
|
```
|
||
|
|
||
|
## git lfs
|
||
|
|
||
|
### Show files
|
||
|
|
||
|
```bash
|
||
|
git lfs ls-files
|
||
|
```
|
||
|
|
||
|
### Show files in the entire history
|
||
|
|
||
|
```bash
|
||
|
git lfs ls-files --all
|
||
|
```
|