GIT的使用技巧

  • GIT主要步骤:

添加(add) 、提交(commit)、远程推送(push)、远程克隆(clone)、远程更新(pull)

其它命令:branch、tag、remote、checkout、merge、log、status 、fetch、rebase

#添加指定文件至暂存区

git add

#添加指定目录至暂存区

git add

#添加所有

git add -A

#将指定目录及子目录移除出暂存区

git rm --cached target -r

#添加勿略配置文件 .gitignore

本地提交

#提交至本地仓库

git commit -m '提交评论'

#快捷提交至本地仓库

git commit -Am '快添加与提交'

分支管理

#查看当前分支

git branch [-avv]

#基于当前分支新建分支

git branch

#基于提交新建分支

git branch

#切换分支

git checkout

#合并分支

git merge

#解决冲突,如果因冲突导致自动合并失败,此时 status 为mergeing 状态.

#需要手动修改后重新提交(commit)

 

 

远程配置

#查看远程配置

git remote [-v]

#添加远程地址

git remote add origin http:xxx.xxx

#删除远程地址

git remote remove origin

#上传新分支至远程

git branch origin -u

#将本地分支与远程建立关联

git branch --track --set-upstream-to=origin/test test

tag 管理

#查看当前

git tag

#创建分支

git tag

#删除分支

git tag -d

 

你可能感兴趣的:(GIT的使用技巧)