Skip to content

Instantly share code, notes, and snippets.

@b2977053
b2977053 / .markdown
Created March 2, 2024 17:22
新 頭目時間表
git log --pretty=format:'%Cred%h%Creset %ad |%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset [%Cgreen%an%Creset]' --abbrev-commit --date=short
[Commit Formatting](https://git-scm.com/docs/git-log#_commit_formatting)
```
--graph
text-based graphical representation
--abbrev-commit
只顯示部分訊息
--date=short
git config --global alias.st status
git config --global alias.sts 'status -s'
git config --global alias.addall add .
git config --global alias.readd restore --staged
git config --global alias.cm commit
git config --global alias.lol 'log --oneline'
git config --global alias.type 'cat-file -t'
git config --global alias.dump 'cat-file -p'
git config --global alias.b branch
git config --global alias.ba 'branch -a'
mkdir git-stash
cd git-stash
git init
echo 'Initial commit' > a.txt
git add .
git commit -m 'Initial commit'
echo 'v2' > a.txt
git add .
echo 'v3' > a.txt
git stash -u
# 建立資料夾 與 版本庫
mkdir git-rebase-demo
cd git-rebase-demo
git init
# 新增檔案 a.txt ~ D.txt 並分別提交。
echo 'a.txt first commit' > a.txt
git add .
git commit -m 'a.txt first commit'
echo 'b.txt first commit' > b.txt
# 建立資料夾 與 版本庫
mkdir git-rebase-demo
cd git-rebase-demo
git init
# 新增檔案 a.txt、b.txt 並分別提交。
echo 'a.txt first commit' > a.txt
git add .
git commit -m 'a.txt first commit'
echo 'b.txt first commit' > b.txt
# 建立資料夾 與 版本庫
mkdir git-rebase-demo
cd git-rebase-demo
git init
# 新增檔案 a.txt、b.txt 並分別提交。
echo 'a.txt first commit' > a.txt
git add .
git commit -m 'a.txt first commit'
echo 'b.txt first commit' > b.txt
# 建立資料夾 與 版本庫
mkdir git-rebase-demo
cd git-rebase-demo
git init
# 新增檔案 a.txt、b.txt 並分別提交。
echo 'a.txt first commit' > a.txt
git add .
git commit -m 'a.txt first commit'
echo 'b.txt first commit' > b.txt
cherry-pick
挑選 <SHA1> 合併到本分支
# 建立資料夾 與 版本庫
mkdir git-cherry-pick-demo
cd git-cherry-pick-demo
git init
# 新增檔案 a.txt 並提交。
# 建立資料夾
mkdir git-revert-demo
cd git-revert-demo
# 建立版本庫
git init
# 新增檔案 a.txt 並提交。
echo 'a.txt first commit' > a.txt
git add .