美文网首页
git基础使用

git基础使用

作者: songjk | 来源:发表于2019-04-28 14:45 被阅读0次

获取一个新仓库

git clone new.git

本地工程初始化git

git init

设置个人信息

git config --global user.name songjk
git config --global user.email 447299884@qq.com

本地工程添加远程git仓库

remote add origin yourgit.git

查询远程git仓库

git remote -v

删除一个关联的远程仓库 origin

git remote rm origin

拉取远程仓库

git pull
如果报错:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
输入把本地master分支关联到远程master分支:
git branch --set-upstream-to=origin/master master
如果继续报错:
fatal: refusing to merge unrelated histories
输入:
git pull --allow-unrelated-histories

添加全部未跟着的文件

git add -A

提交到本地仓库

git commit -m"日志"

推送到远程仓库

git push

查询所有分支

git branch -a

创建本地分支

git branch dev

切换本地分支

git checkout dev

创建同时切换分支

git checkout -b dev

合并指定分支到当前分支

git merge dev

相关文章

网友评论

      本文标题:git基础使用

      本文链接:https://www.haomeiwen.com/subject/fgmdnqtx.html