This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立資料夾 與 版本庫 | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立資料夾 與 版本庫 | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立資料夾 與 版本庫 | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立資料夾 與 版本庫 | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cherry-pick | |
挑選 <SHA1> 合併到本分支 | |
# 建立資料夾 與 版本庫 | |
mkdir git-cherry-pick-demo | |
cd git-cherry-pick-demo | |
git init | |
# 新增檔案 a.txt 並提交。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立資料夾 | |
mkdir git-revert-demo | |
cd git-revert-demo | |
# 建立版本庫 | |
git init | |
# 新增檔案 a.txt 並提交。 | |
echo 'a.txt first commit' > a.txt | |
git add . |
NewerOlder