标签:branch status 用户信息 etc 添加 指定 远程 pre check
显示当前配置: git config --list
设置提交代码时的用户信息:
1. git config [--global] user.name "[name]"
2. git config [--global] user.email "[email address]"
初始化一个Git仓库: git init
添加文件到仓库: git add <<文件>>
添加当前目录的所有文件到暂存区: git add .
提交工作区自上次commit之后的变化,直接到仓库区: git commit -a
提交暂存区到仓库区: git commit -m "msg"
提交时显示所有diff信息: git commit -v
看看仓库的当前状态: git status
查看修改内容: git diff <<文件>>
穿梭到指定版本: git reset --hard commit_id
查询版本历史: git log
重返未来,查看命令历史: git reflog
丢弃工作区的修改: git checkout -- file
删除文件: git rm 文件
1. 关联一个远程库: git remote add origin ssh://git@39.108.16.93:20022/liubq/testGit.git
2. 远程库推送: git push -u origin master (第一次添加-u)
1. 下载到当前文件夹: git clone ssh://git@39.108.16.93:20022/liubq/testGit.git
2. 下载远程仓库的所有变动: git fetch [remote]
3. 显示所有远程仓库: git remote -v
4. 增加一个新的远程仓库,并命名: git remote add [shortname] [url]
5. 取回远程仓库的变化,并与本地分支合并: git pull [remote] [branch]
6. 上传本地指定分支到远程仓库: git push [remote] [branch]
7. 强行推送当前分支到远程仓库,即使有冲突: git push [remote] --force
8. 推送所有分支到远程仓库: git push [remote] --all
查看本地分支: git branch
列出所有远程分支: git branch -r
列出所有本地分支和远程分支: git branch -a
创建分支: git branch <branchName>
切换分支: git checkout <branchName>
创建+切换分支: git checkout -b <branchName>
合并某分支到当前分支: git merge <branchName>
删除分支: git branch -d <branchName>
删除远程分支: 1. git push origin --delete [branch-name] 2. git branch -dr [remote/branch]
提交本地test分支作为远程的master分支: git push origin test:master
提交本地test分支作为远程的test分支: git push origin test:test
标签:branch status 用户信息 etc 添加 指定 远程 pre check
原文地址:https://www.cnblogs.com/bingqiangliu/p/9408702.html