Skip to content

Git

HowTo

Init

空目錄: 加一個 .gitkeep 檔案

Branch

從舊的commit開新的branch
git checkout -b new-branch <commit-hash>

Remote branch

看所有remote branch
git branch -r
Update from remote branch
$ git fetch origin discover:discover && git checkout discover
# or
$ git fetch origin aRemoteBranch
$ git checkout aLocalBranch
$ git merge origin/aRemoteBranch
push to remote
git push {remote-repo} {branch name}
Revert remote repo
 git reset --hard <commit-hash>
 git push -f origin master