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. IDEA(2018.3.2)

    N757JE0KCT-eyJsaWNlbnNlSWQiOiJONzU3SkUwS0NUIiwibGljZW5zZWVOYW1lIjoid3UgYW5qdW4iLCJhc3NpZ25lZU5hbWUiO ...

  2. 关于linux‘RedHat6.9在VMware虚拟机中的安装步骤

    redhat支持多种安装方式:光盘安装,硬盘安装和网络安装等,可以根据个人的实际情况来选择.我在这里选择的是光盘安装的方式安装RHEL6.9.(以下简称6.9) 1.首先准备好6.9的光盘镜像,在安装 ...

  3. Java并发之synchronized使用

    synchronized,是Java语言的关键字,读['siŋkrənaizd],当它用来修饰一个方法或者一个代码块的时候,能够保证在同一时刻最多只有一个线程执行该段代码. 一.Java为何要使用sy ...

  4. ORALCE表的约束条件

    一.主键:(PRIMARY KEY) 主键是表中的一列或多列.为表定义主键有如下几个作用: 1.主键包含的列不能输入重复的值,以此来保证一个表的所有行的唯一性: 2.主键也不允许定义此约束的列为NUL ...

  5. 谈谈php对象的依赖

    通过构造函数的方法 <?php //定义一个类,后面的类依赖这个类里面的方法 class play { public function playing() { echo "I can ...

  6. 网站用户行为分析——Hadoop的安装与配置(单机和伪分布式)

    Hadoop安装方式 Hadoop的安装方式有三种,分别是单机模式,伪分布式模式,伪分布式模式,分布式模式. 单机模式:Hadoop默认模式为非分布式模式(本地模式),无需进行其他配置即可运行.非分布 ...

  7. ruby中的respond to ?用法

    今天写脚本,遇到了这个函数,遂搜索及阅读相关代码,整理如下: respond_to 是判断是否是某个类型的方法,比如: ar = "ss" p ar.respond_to?(:to ...

  8. java 写一个单例设计程序,打印出该对象的地址

    class Test{ public static void main(String[] args) { singleton s1=singleton.getinstance(); singleton ...

  9. EOJ Monthly 2019.3 A

    A. 钝角三角形 单点时限: 3.0 sec 内存限制: 512 MB QQ 小方以前不会判断钝角三角形,现在他会了,所以他急切的想教会你. 如果三角形的三边长分别为 a, b, c (a≤b≤c), ...

  10. Vue 生产环境部署

    简要:继上次搭建vue环境后,开始着手vue的学习;为此向大家分享从开发环境部署到生产环境(线上)中遇到的问题和解决办法,希望能够跟各位VUE大神学习探索,如果有不对或者好的建议告知下:*~*! 一. ...