[git] Git in Practice
Work flow with git and github

Work with Remotes
Check the current status
git status
Check the latest source on remote branch
git fetch
git status
git log <remote>/<branch> --not <current_branch>
git merge <remote>/<branch>
Add an remote Repo
git remote add <shortname> <url>
Check the remote
git remote -v // check all remote
git remote show <remote> // show the detail status of an remote
Rename an rename
git remote rename <origin> <destination>
Remove the upstream for the current branch
git branch --unset-upstream
Change the remote that <branchA> is trancing
git branch <branchA> -u <new_remote>/<branch>
Push the current branch as an new branch to remote
git push <remote> <branch>
Push changes to another remote branch
git push <new_remote>/<branch>
Work with Branches
Check branches
git branch // check local branches
git branch --all // check local and remote branches
Create a new branch
git branch branchA // create a new branch based on the current branch
git branch branchB <remote>/<branch> // create a new branch that traces <remote>/<branch>
Switch branch
git checkout branchB // change the current branch to branchB
Check the mapping between local branch and remote branch
git branch -vv
Rename an branch
git branch -m <oldname> <newname>
Others Common Commands
Show the content of an commit
git show <commit-id>
git show <commit-id> --name-only
Check differences according log
git log branchA --not branchB
git log branchA --not branchB --name-only
Obtain the latest source under version control
git checkout <file-name> // checkout the latest file under version control, and discard local changes
git checkout <branchA> // switch the current branch to branchA
Commit changes
git commit -m '' . // submit all tranced files under the current folder, no matter if they are git-added
Reference:
[git] Git in Practice的更多相关文章
- error setting certificate verify locations: CAfile: E:/git/Git/mingw64/ssl/certs/ca-bundle.crt
一.问题: 当git clone项目时报 error setting certificate verify locations: CAfile: E:/git/Git/mingw64/ssl/cert ...
- [git]git 分支
什么动作,关键看你想完成什么 1. 添加新的远程分支: git push origin current_local_branch:new_remote_branch 2. 删除远程分支(冒号前必须要有 ...
- [git] git 的基本认知
版本管理 ( Version Control ) 版本管理系统是一个记录文件变更的系统,让你在一段时间后可以恢复指定版本的文件.版本管理系统大致可分为三类:独立的本地版本管理系统.中心化版本管理系统. ...
- Git -> Can't start Git: git.exe
问题描述 导入别人的PyCharm项目后提示:Can't start Git:git.exe 解决办法 Git就是个类似插件,在Git的官网上注册个账号然后每次编译就会自动把程序上传到网上备份.可以方 ...
- GIt -- git push 远程分支老是需要重新输入公钥密码问题处理?
步骤: 先查看远程有哪些分支 删除远程分支,重新关联远程分支 最后再git push 到远程分支 git remote -v git remote rm RedisNote git remote a ...
- [git] git怎样fork一个repo
描述 我定制了一下strongswan的工程.然后想把我自己的定制变成一个repo push到远端git.tong.com与大家分享. 这个时候,应该怎么做? 如果你用过github的话.那么你可以理 ...
- [skill][git] git 常用操作记录
傻瓜入门: step by step : https://try.github.io/levels/1/challenges/1 一本书: https://git-scm.com/book/en/v2 ...
- [git]git project仓库迁移
转自:https://segmentfault.com/q/1010000000124379 如果你想从别的 Git 托管服务那里复制一份源代码到新的 Git 托管服务器上的话,可以通过以下步骤来操作 ...
- can't start Git: git.exe
can't start Git: git.exe :不能启动Git 这是因为Git的可执行文件的路径不正确,需要手动设置,. 找到设置Git的窗口 然后修改一下路径就行了 点击OK就可以了.
- IDEA 中 使用 git(Git)
GitLab GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务.安装方法是参考GitLab在GitHub上的Wiki页面. Git Git( ...
随机推荐
- ELK6.7.0 Windows 环境本地安装
安装环境环境准备 第一次写博文,排版比较乱,理解万岁 ELK 6.7.0三件套 下载地址:https://www.elastic.co/cn/downloads/ windows环境下默认已配置jdk ...
- #leetcode刷题之路37-解数独
编写一个程序,通过已填充的空格来解决数独问题.一个数独的解法需遵循如下规则:数字 1-9 在每一行只能出现一次.数字 1-9 在每一列只能出现一次.数字 1-9 在每一个以粗实线分隔的 3x3 宫内只 ...
- ubuntu18.04错误配置变量环境导致无法进入系统
1.问题描述 错误配置环境变量(直接在/etc/profile文件末尾添加了export xxx),关机后一直在登录界面循环无法进入系统. ###环境变量的添加是在原有变量之后以冒号(:)分隔加入,并 ...
- redhat系统升级openssh到7.5
注意,注意,注意重要的事情说三遍,关于ssh的升级不能完全按照别人的教程进行升级,因为每台生产机器都是不一样的,有可能别人能升级成功但是另外一个就可能会失败,因为每台机器上面跑的应用是不一样的,涉及到 ...
- JPMML解析PMML模型并导入数据进行分析生成结果
JPMML解析Random Forest模型并使用其预测分析 导入Jar包 maven 的pom.xml文件中添加jpmml的依赖 <dependency> <groupId> ...
- Git安装配置(Windows)
下载Git并安装 下载地址:https://git-scm.com/ 安装一般默认即可 配置用户信息 配置之前最好已经有了Github的账号,如果没有可以先去注册一个 安装后打开Git Bash gi ...
- 北京Uber优步司机奖励政策(3月26日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 百度地图 ver2.0 api
百度地图JavaScript API是一套由JavaScript语言编写的应用程序接口,可帮助您在网站中构建功能丰富.交互性强的地图应用,支持PC端和移动端基于浏览器的地图应用开发,且支持HTML5特 ...
- CLR via c#读书笔记八:泛型
1.定义泛型类型或方法时,为类型指定的任何变量(比如T)都称为类型参数.使用泛型类型或方法时指定的具体数据类型称为类型实参. 2.System.Collections.Concurrent命名空间提供 ...
- itop4412开发板添加开机启动程序
1. 先编写代码,以helloworld.c为例子 #include<stdio.h> #include<unistd.h> //这个文件是什么 main() { ; ) { ...