[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( ...
随机推荐
- AppleDoc
使用AppleDoc快速生成iOS开发文档 _ 皮卡丘♪-(´ε` ) 用 appledoc 生成文档 _ Garan no dou xcode-select_ error_ tool 'xcodeb ...
- 【Spark】Spark核心之弹性分布式数据集RDD
1. RDD概述 1.1 什么是RDD (1) RDD(Resilient Distributed Dataset)弹性分布式数据集,它是Spark的基本数据抽象,它代表一个不可变.可分区.里面的元素 ...
- 6、core dump 故障分析
Core Dump-定义Core Dump又叫核心转存.当程序在运行过程中发生异常, 这时Linux系统可以把程序出错时的内存内容存储在一个core文件中, 这种过程叫Core Dump. Segme ...
- python教程(二)·条件语句
条件语句一般用来判断给定的条件是否成立,根据结果来执行不同的代码,也就是说,有了条件语句,才可以根据不同的情况做不同的事,从而控制程序的流程. 布尔类型 前面说到数据类型的时候,其中有一种叫 &quo ...
- 部署zabbix,自动发现lnmp环境,监控主机状态,实现 邮件及微信报警(配置server端)
二.配置server端监控 1.监控apache 首先在本机下载模板:https://github.com/rdvn/zabbix-templates/archive/master.zip 该 zi ...
- [HDU6326]Monster Hunter(贪心)
用(a,b)表示一个点先失去a点HP,然后增加b点HP 首先容易证明忽略父亲条件下,任意两个点,先吃b大的最优 对于一个节点v和它的父节点u,若此时选v最优,那么就是吃到u时可以立即吃掉v, 于是可以 ...
- JSON初体验(三):FastJson解析
JSON解析之FastJson(阿里巴巴解析开源) 特点: Fastjson是一个Java语言编写的高性能功能完善的JSON库,它采用的 是一种"假定有序快速匹配"的算法,把JSO ...
- Codevs1332_上白泽慧音_KEY
题目传送门 裸的模板题,Tarjan求联通量. code: #include <cstdio> #include <vector> #define min(a,b) a< ...
- P1488 肥猫的游戏
题目描述 野猫与胖子,合起来简称肥猫,是一个班的同学,他们也都是数学高手,所以经常在一起讨论数学问题也就不足为奇了.一次,野猫遇到了一道有趣的几何游戏题目,便拿给胖子看.游戏要求在一个有n个顶点凸多边 ...
- 北京Uber优步司机奖励政策(1月25日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...