zoukankan      html  css  js  c++  java
  • [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-scm

  • 相关阅读:
    SVM神经网络的术语理解
    优化问题中的正则项作用
    转 强烈推荐遗传算法入门例子
    21分钟 MySQL 入门教程
    C++中abs、fabs、fabsf的使用方法
    国内有哪些质量高的JAVA社区?
    <Eclipse 学习笔记> Eclipse 开发常用快捷键
    <Servlet 学习笔记 > Servlet 生命周期和工作原理
    HDU
    POJ
  • 原文地址:https://www.cnblogs.com/TonyYPZhang/p/6603029.html
Copyright © 2011-2022 走看看