Git 基本命令

来源:互联网 发布:七匹狼授权淘宝网店 编辑:程序博客网 时间:2024/06/04 01:13

从现有仓库克隆
git clone [url]

在工作目录中初始化新仓库
git init

删除本地所有未提交的更改
git clean -xdf

同步远程仓库
git pull

添加到索引库
git add

修改合并到当前分支
git merge –squash [local LLV branch]

提交当前工作空间的修改内容
git commit git commit –amend 改写提交)

推送本地分支到远程分支
git push origin HEAD:refs/for/[branch_name]

查询本地git库的状态
git status (通过git status -uno 只列出所有已经被修改但没提交的文件)

分支查询
git branch 查看当前分支(git branch -r 查看远程分支,git branch -vv查看本地/远程分支关联关系)

切换到分支
git checkoutgit checkout -b [branch] 创建并切换)

原创粉丝点击