您的位置:首页 > 其它

git 工作常用命令

2018-03-15 00:00 369 查看
git log --pretty=oneline // 看看提交日志
git remote update // 更新远程代码
git stash // 隐藏本地修改
git rebase origin/develop 合并远程和本地
git stash pop 打开本地隐藏,
git branch 查看分支,如果有冲突分支会变

git log --pretty=oneline 看提交日志
git status 查看本地git变化
git add . 加入到版本库
git commit -m "" 提交
git push origin 当前分支名 // 推到远程

git checkout develop 切换分支
git branch -a 查看所有分支

命令行指令

Git 全局设置

git config --global user.name "aaaa"
git config --global user.email "aaaa@autohome.com.cn"

创建新版本库

git clone git@git.corpautohome.com:aaaa/abcd.git
cd abcd
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

已存在的文件夹

cd existing_folder
git init
git remote add origin git@git.corpautohome.com:aaaa/abcd.git
git add .
git commit -m "Initial commit"
git push -u origin master

已存在的 Git 版本库

cd existing_repo
git remote rename origin old-origin
git remote add origin git@git.corpautohome.com:aaaa/abcd.git
git push -u origin --all
git push -u origin --tags
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: