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

  • 相关阅读:
    Struts2.1.8 + Spring3.0+ Hibernate3.2整合笔记
    SSH整合之_架构的历史序列图
    Spring整合Hibernate笔记
    Oracle日志文件的管理与查看
    java调用Oracle存储存储过程
    Oracle PLSQL笔记(过程的创建和及调用)
    使用 Spring 2.5 TestContext 测试DAO层
    SpringBoot 启动慢的解决办法
    C++ CEF 浏览器中显示 Tooltip(标签中的 title 属性)
    Chromium CEF 2623 -- 支持 xp 的最后一个版本源码下载和编译步骤
  • 原文地址:https://www.cnblogs.com/TonyYPZhang/p/6603029.html
Copyright © 2011-2022 走看看