原创

Git常用命令

下载项目

$ git clone [url]

添加当前目录到暂存区

$ git add .

提交

$ git commit -m [message]

列出所有分支

$ git branch -a

显示所有远程仓库

$ git remote -v

拉取远程代码,并与本地分支合并

$ git pull [remote] [branch]

上传本地指定分支到远程仓库

$ git push [remote] [branch]

强行推送当前分支到远程仓库,即使有冲突

$ git push [remote] --force

首次建库

#首次建库,并推送到gitee,报错refusing to merge unrelated histories,解决如下
$git pull origin master --allow-unrelated-histories

正文到此结束
相关文章