2013年10月8日 星期二

git基本操作

建立tag:
ex:
git tag MyApp1

更新tag資訊到server:
git push --tags


delete local branch
    git branch -d branch1
    git branch -D branch1

建立branch
ex: 建立branch test
 git  branch  test

建立並切換branch
git checkout -b test

add remote
git remote add origin git@github.com:AppPeterPan/test.git
git push -u origin master

將local branch push到遠端
ex, 將branch test push 到遠端:
git push origin test

remote remote
ex
git remote rm  origin

切換到branch
ex: 切換到branch test
git checkout  test

git checkout -f testapi
   強制切換branch


merge branch:
    git merge test --no-ff
 
push local branch to remote
   git push -u origin test

go back to specific commit  ( the commit after it will be deleted)
    git reset --hard <sha1-commit-id>

merge specific commit
git cherry-pick 8ee261dbffe27b78890e813b7909010055bf2f8e -x
-x will record commit id

delete remote commit:
ex:
刪除commit 40121d242a
git push origin +40121d242a^:master



沒有留言:

張貼留言