配置 config
git config --global user.name "Administrator"
git config --global user.email "root@example.com"
clone 项目
git clone https://git.woa.com/group_path/project_path.git
创建并切换分支
git checkout –b test(分支名)
添加修改的文件到缓存区
git add 文件名
查看状态
git status
提交代码到本地仓库
git commit –m "描述信息"
查看历史
git log
拉取远程仓库最新代码
git pull origin test
推送代码到远程仓库
git push origin test
本地合并分支 (合并前要切分支和拉最新代码)
git checkout master
git pull origin master
git merge test
变基 rebase 合并(rebase 后还要回到主分支 merge)
git checkout test
git rebase master
打 tag,查看 tag
git tag v1.0
git tag
git push origin v1.0
关联远程仓库
cd existing_folder
git init
git remote add origin url
git add .
git commit -m "init"
git push -u origin master
查看当前远程仓库地址
git remote –v
http 与 ssh 互转
git remote set-url origin https://xxxxxxx.git
git remote set-url origin git@git.xxxxx.git