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

  • 相关阅读:
    初解DLL基本知识
    读《暗时间》笔记
    红队 Cobalt Strike 安全加固
    《天书夜读 —— 从汇编语言到Windows内核编程》3.3 汇编反C语言练习 参考答案
    记录一次从WordPress后台到拿下主机shell的渗透
    今日记 2019.6.19
    解决Termux无法通过metasploit.sh安装Metasploit的问题
    解决ajax中文乱码问题
    jsp开发知识
    第一个Java web项目:员工管理系统
  • 原文地址:https://www.cnblogs.com/TonyYPZhang/p/6603029.html
Copyright © 2011-2022 走看看