Git 常见命令的使用
来源:互联网 发布:瑞士莲 费列罗 知乎 编辑:程序博客网 时间:2024/06/06 05:03
ssh-key
//1.生成ssh-key(在用户家目录.ssh文件下)ssh-keygen -t rsa -C "Z-Beatles@waynechu.cn"//2.重命名ssh-keycp ~/.ssh/id_rsa.pub ~/.ssh/Z-Beatles@waynechu.cn.pub//3.添加public key到github
init repo
cd 'repo'//本地初始化仓库git init//创建远程仓库git remote add origin git@github.com:Z-Beatles/reponame.git//把文件添加到暂存区git add .//把暂存区内容提交到当前分支git commit -m "reason"//推送到远程服务器git push origin master
clone repo
//Clone with SSHgit@github.com:Z-Beatles/MobileSafe.git//Clone with HTTPShttps://github.com/Z-Beatles/MobileSafe.git
分支管理 branch
//查看分支git branch//创建分支git branch 'newbranch'//切换分支git chechout 'branchname'//创建并切换到该分支git checkout –b 'branchname'//合并某分支到当前分支git merge 'branchname'//删除分支git branch -d 'branchname'//强制删除某个分支 (未被合并的分支被删除的时候需要强制)git branc -D 'branchname'
查看文件 diff
//比较当前文件和暂存区文件差异git diff <file>//比较两次提交之间的差异git diff <id1><id1><id2>//在两个分支之间比较git diff <branch1>..<branch2>//比较暂存区和版本库差异(默认)git diff --staged//比较暂存区和版本库差异git diff --cached//仅仅比较统计信息git diff --stat
暂存管理 stash
//暂存git stash//列所有stashgit stash list//恢复暂存的内容git stash apply//删除暂存区git stash drop
Git远程仓库管理
//查看远程服务器地址和仓库名称git remote -v //查看远程服务器仓库状态git remote show origin//添加远程仓库地址git remote add origin git@github.com:Z-Beatles/reponame.git//设置远程仓库地址 (用于修改远程仓库地址)git remote set-url origin git@github.com:Z-Beatles/reponame.git//删除远程仓库git remote rm <repository>
0 0
- Git 常见命令的使用
- git常见的命令使用
- Git使用常见命令
- git常见命令使用
- git 常见使用命令
- git常见的使用命令介绍
- 常见的git命令
- 常见的 Git 命令:
- 常见的GIT命令
- 常见的git命令
- git的常见命令
- git使用(一):常见的git命令
- git常见命令及使用
- git常见场景命令使用
- GIT使用-1.GIT常见命令学习
- Git使用常见命令的理解和记录
- git常见命令与github仓库的使用
- git常见的命令总结
- 大数据分析在金融行业的应用与趋势
- 3.1 我的unreal4征程之旅开始--关于VS中直接启动游戏
- mysqli 过程
- MapReduce工作原理图文详解
- javascript闭包
- Git 常见命令的使用
- isset()和empty()区别,及判断$_post['']时问题
- jdk 安装和配置以及如何在MyEclipse中配置
- 生日会流程
- 怎么测试一个java程序占用的内存和cpu消耗?
- 发布自己的Angular2库初探
- shape样式
- 给php代码添加规范的注释phpDocumentor
- 基于tiles框架下spring mvc错误页面集成