我就不信了git這個東西 還能難到我。

git-init 初始化一個repository
git-add . "." 表示全部
剛剛新建立的只有master一個branch 並且在沒有commit之前不能建立新的branch
git-branch branchname 新建立一個branchname
git-branch 顯示現有branch
git-branch -d branchname 刪除branchname 但是分之內容的改動還是保留的,-D 就完全刪除一個分支了
git-checkout branchname 轉到這個branchname
git-merge branchname 把branchname 的分支和當前的分支合併。
git-diff 顯示不同(commit之前)git-log查看當前的記錄 git-status查看當前的狀態
在使用git-commit -a 的時候加入comment的時候 第一行加入不多餘50字的summary 然後空一行,然後寫詳細的內容
gitk 是一個好用的圖形化工具。
git pull /home/bob/myrepo master 
This merges the changes from Bob's "master" branch into Alice's current This merges the changes from Bob's "master" branch into Alice's current
branch. If Alice has made her own changes in the meantime, then she may need to
manually fix any conflicts. (Note that the "master" argument in the above command is actually unnecessary, as it is the default.)
branch
pull = fetch + merge


在決定向服務器push代碼的時候向master分枝,要保證本地的master是要上傳的代碼,這樣纔可以。我一般都是先把自己的遠端的分枝push然後再push遠端的master
刪除 遠程分支  git-push origin : branchname
要用本地分支向遠程分支push 不能跨分枝
刪除遠程分支以後本地還是留有遠程的副本可以使用git-branch -rd branch name 刪除
在新clone下來的東西默認是在本地的master分支 ,如果要是想要向遠程的非master分支push東西,就是使用全的命令行 :
git-push orgin master:otherbranchname

git checkout -b ebipr --track origin/keyboard

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章