楊育晟(Peter Yang)

嗨, 我叫育晟, 部落格文章主題包含了程式設計、財務金融及投資...等等,內容多是記錄一些學習的過程和心得,任何想法都歡迎留言一起討論。



Email: ycy.tai@gmail.com
LinkedIn: Peter Yang
Github: ycytai

Common Git Commands

Create new branch

git checkout -b <branch-name>

Reset modified files

git checkout HEAD -- <file-name>  # specific file
git checkout HEAD -- . # all current modified

Rebase wit specific branch or commit

git rebase <branch-name>
git rebase -i <commit-id>

Add changes

git add <file-name>
git add .

Commit changes

git commit -m <message-content>

Add changes to latest commit

git commit --amend
git commit --amend --no-edit # no need to edit commit message

Show changes

git diff
git diff <file-name>
git diff HEAD~1 # compare with HEAD
git show <commit-id> 

Rename branch

git branch -m <new-branch-name>

Delete remote branch

git push origin -d <branch-name>
Tags:
# git