Git

作者: yanlolo | 来源:发表于2018-02-20 21:17 被阅读0次

    Remoteadd

    [if !supportLists]a.      [endif]Git remote add yyan url_link

    [if !supportLists]b.      [endif]Git remote show yyan

    [if !supportLists]c.      [endif]Git remote -v

    [if !supportLists]d.      [endif]Git fetch yyan

    [if !supportLists]e.      [endif]Git checkout yyan_feature_branch

    Rebase

    [if !supportLists]a.      [endif]Git commit -m '''''

    [if !supportLists]b.      [endif]Git rebase -i HEADE~2

    [if !supportLists]c.      [endif]Git push -f

    Gitcommit --amend -m "new commit,  gitpush -f

    Codereview

    [if !supportLists]a.     [endif]转到原repo,PR不在fork的repo上面

    [if !supportLists]b.     [endif]git fetch origin pull-requests/5/from:pr5

    [if !supportLists]c.      [endif]Git checkout pr5

    [if !supportLists]d.      [endif]Intellj=>VCS=>Git=>Branches=>compare

    Deletelocal branch

    [if !supportLists]a.      [endif]Git branch -D local_branch

    Addall

    [if !supportLists]a.      [endif]Git add -A

    Update

    Before you can start working locally on aremote branch, you need to fetch it as called out in answers below.

    To fetch a branch, you simply need to:

    git fetch origin

    This will fetch all of the remote branches foryou. You can see the branches available for checkout with:

    git branch -v -a

    With the remote branches in hand, you now needto check out the branch you are interested in, giving you a local working copy:

    git checkout -b test origin/test

    From <http://stackoverflow.com/questions/1783405/how-to-check-out-a-remote-git-branch>

    Git rebase

    Git --auto rebase master feature

    主要是为了log清晰,减少branch的交叉

    -如果master branch 超前于feature branch,在push之前,先git rebase master

    -如果想修改之前的commit,先git rebase -I 到之前的commit,再修改git commit amend

    c8

    相关文章

      网友评论

          本文标题:Git

          本文链接:https://www.haomeiwen.com/subject/mhzgtftx.html