git分支創建以及一些常見問題

查看當前分支 :git branch

>> git branch
a_branch
b_branch
* master

切換分支/創建分支(當此分支不存在是將會創建此分支):git checkout branch_name

##切換到a_branch分支
>> git checkout a_branch

如果你要將現有倉庫的代碼克隆下來:git clone url

git clone https://github.com/...

如果你要取回遠程某一分支的提交:git pull origi如果我們已經通過git cn branch_name

git pull origin branch_name

上傳文件

git add .
git commit -m "your annotation"
git push origin branch_name

git commit 撤銷操作:

git reset --soft HEAD^

git add 和 git commit 撤銷:

git reset --mixed  HEAD^

git status 查看當前狀態

發佈了53 篇原創文章 · 獲贊 15 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章