20251128 北資大社課
Claire
Version Control
Git/Github
References
What is Git?
CLI
$ git status:Untracked Files / Changes not staged for commit$ git add <file> 把檔案扔到暫存區$ git status:Changes to be committed、new file$ git commit <file> 扔進 repo$ git log 查看完整 commit 歷史
$ git log --oneline --graph --decorate$ git add .
$ git commit -m "commit message"$ git branch feature1 # 建立 feature1 這個 branch
$ git checkout feature1 # 把 HEAD 移到 feature1
Switched to branch 'feature1'
$ git checkout -d feature2 # 建立 feature2 這個 branch 並把 HEAD 移到 feature2
Switched to a new branch 'feature2'...
<<<<<<< HEAD (Current Change)
你在的 Branch 的 Commit
=======
Merge 進來的 Branch 的 Commit
>>>>>>> branch-name (Incoming Change)
...$ git add 再 $ git merge --continue
$ git merge <branch> -m "merge message"
$ git checkout <你要接在後面的那個 branch>
$ git rebase <接在你前面 branch>
$ git checkout cat
$ git rebase dog
$ git rebase -i HEAD~n