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-scm

[git] Git in Practice的更多相关文章

  1. 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 ...

  2. [git]git 分支

    什么动作,关键看你想完成什么 1. 添加新的远程分支: git push origin current_local_branch:new_remote_branch 2. 删除远程分支(冒号前必须要有 ...

  3. [git] git 的基本认知

    版本管理 ( Version Control ) 版本管理系统是一个记录文件变更的系统,让你在一段时间后可以恢复指定版本的文件.版本管理系统大致可分为三类:独立的本地版本管理系统.中心化版本管理系统. ...

  4. Git -> Can't start Git: git.exe

    问题描述 导入别人的PyCharm项目后提示:Can't start Git:git.exe 解决办法 Git就是个类似插件,在Git的官网上注册个账号然后每次编译就会自动把程序上传到网上备份.可以方 ...

  5. GIt -- git push 远程分支老是需要重新输入公钥密码问题处理?

     步骤: 先查看远程有哪些分支 删除远程分支,重新关联远程分支 最后再git push 到远程分支 git remote -v git remote rm RedisNote git remote a ...

  6. [git] git怎样fork一个repo

    描述 我定制了一下strongswan的工程.然后想把我自己的定制变成一个repo push到远端git.tong.com与大家分享. 这个时候,应该怎么做? 如果你用过github的话.那么你可以理 ...

  7. [skill][git] git 常用操作记录

    傻瓜入门: step by step : https://try.github.io/levels/1/challenges/1 一本书: https://git-scm.com/book/en/v2 ...

  8. [git]git project仓库迁移

    转自:https://segmentfault.com/q/1010000000124379 如果你想从别的 Git 托管服务那里复制一份源代码到新的 Git 托管服务器上的话,可以通过以下步骤来操作 ...

  9. can't start Git: git.exe

    can't start Git: git.exe :不能启动Git 这是因为Git的可执行文件的路径不正确,需要手动设置,. 找到设置Git的窗口 然后修改一下路径就行了 点击OK就可以了.

  10. IDEA 中 使用 git(Git)

    GitLab GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务.安装方法是参考GitLab在GitHub上的Wiki页面. Git Git( ...

随机推荐

  1. dva框架使用详解及Demo教程

    dva框架的使用详解及Demo教程 在前段时间,我们也学习讲解过Redux框架的基本使用,但是有很多同学在交流群里给我的反馈信息说,redux框架理解上有难度,看了之后还是一脸懵逼不知道如何下手,很多 ...

  2. LeetCode 中级 - 组合总和II(105)

    给定一个数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合. candidates 中的每个数字在每个组合中只能使用一次. ...

  3. STL专题·vector容器

    1.构造函数 vector():创建一个空vector vector(int nSize):创建一个vector,元素个数为nSize (vector<int> a(10);) vecto ...

  4. 自动曝光修复算法 附完整C代码

    众所周知, 图像方面的3A算法有: AF自动对焦(Automatic Focus)自动对焦即调节摄像头焦距自动得到清晰的图像的过程 AE自动曝光(Automatic Exposure)自动曝光的是为了 ...

  5. SpringBoot整合Swagger2以及生产环境的安全问题处理

    1.创建springboot项目 https://www.cnblogs.com/i-tao/p/8878562.html 这里我们使用多环境配置: application-dev.yml(开发环境) ...

  6. 同步请求和异步请求的区别(理解ajax用)

    同步请求:发送方发送数据包后,等待接收方发回响应之后,才能发送下一个数据包的通信方式. 异步请求:发送方发送数据包后,不用等待接收方发回响应,就可以发送下一个数据包的通信方式. 同步通信:要求通信双方 ...

  7. 安装cronsun管理定时脚本

    1. cronsun 是一个分布式任务系统,单个结点和 *nix 机器上的 crontab 近似.支持界面管理机器上的任务,支持任务失败邮件提醒,安装简单,使用方便,是替换 crontab 一个不错的 ...

  8. Hadoop2学习路程-HDFS

    什么是Hadoop HDFS? Hadoop 分布式文件系统是世界上最可靠的文件系统.HDFS可以再大量硬件组成的集群中存储大文件. 它的设计原则是趋向于存储少量的大文件,而不是存储大量的小文件. 即 ...

  9. linux动态链接库

    前言 静态链接库会编译进可执行文件,并被加载到内存,会造成空间浪费 静态链接库对程序的更新.部署.发布带来麻烦.如果静态库更新了,使用它的应用程序都需要重新编译.发布给用户(对于玩家来说,可能是一个很 ...

  10. 天津Uber优步司机奖励政策(1月4日~1月10日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...