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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章