Skip to content

Instantly share code, notes, and snippets.

@marcnewport
Last active December 9, 2019 01:47
Show Gist options
  • Select an option

  • Save marcnewport/f4e17bd0c5f22b6d46d2e91659b48add to your computer and use it in GitHub Desktop.

Select an option

Save marcnewport/f4e17bd0c5f22b6d46d2e91659b48add to your computer and use it in GitHub Desktop.

Revisions

  1. marcnewport revised this gist Dec 9, 2019. 1 changed file with 15 additions and 8 deletions.
    23 changes: 15 additions & 8 deletions git-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,23 @@
    ## Checkout remote branch
    1. Fetch the remote branch references

    `git fetch -p`

    ```
    git fetch -p
    ```
    2. Checkout the remote branch

    `git checkout --track origin/remote-branch`
    ```
    git checkout --track origin/remote-branch
    ```

    ## Rename a branch
    1. You are on the branch you want to rename
    `git branch -m new-name`
    ```
    git branch -m new-name
    ```
    2. Delete the old-name remote branch and push the new-name local branch
    `git push origin :old-name new-name`
    ```
    git push origin :old-name new-name
    ```
    3. Reset the upstream branch for the new-name local branch
    `git push origin -u new-name`
    ```
    git push origin -u new-name
    ```
  2. marcnewport revised this gist Dec 9, 2019. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions git-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,11 @@
    ## Checkout remote branch
    1. Fetch the remote branch references
    `git fetch -p`

    `git fetch -p`

    2. Checkout the remote branch
    `git checkout --track origin/remote-branch`

    `git checkout --track origin/remote-branch`

    ## Rename a branch
    1. You are on the branch you want to rename
  3. marcnewport revised this gist Dec 9, 2019. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions git-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    ## Checkout remote branch
    1. Fetch the remote branch references
    `git fetch -p`
    `git fetch -p`
    2. Checkout the remote branch
    `git checkout --track origin/remote-branch`
    `git checkout --track origin/remote-branch`

    ## Rename a branch
    1. You are on the branch you want to rename
    `git branch -m new-name`
    `git branch -m new-name`
    2. Delete the old-name remote branch and push the new-name local branch
    `git push origin :old-name new-name`
    `git push origin :old-name new-name`
    3. Reset the upstream branch for the new-name local branch
    `git push origin -u new-name`
    `git push origin -u new-name`
  4. marcnewport revised this gist Dec 9, 2019. No changes.
  5. marcnewport revised this gist Dec 9, 2019. 1 changed file with 12 additions and 22 deletions.
    34 changes: 12 additions & 22 deletions git-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,13 @@
    ### Checkout remote branch
    Fetch the remote branch references
    ```
    git fetch -p
    ```
    Checkout the remote branch
    ```
    git checkout --track origin/remote-branch
    ```
    ## Checkout remote branch
    1. Fetch the remote branch references
    `git fetch -p`
    2. Checkout the remote branch
    `git checkout --track origin/remote-branch`

    ### Rename a branch
    You are on the branch you want to rename
    ```
    git branch -m new-name
    ```
    Delete the old-name remote branch and push the new-name local branch
    ```
    git push origin :old-name new-name
    ```
    Reset the upstream branch for the new-name local branch
    ```
    git push origin -u new-name
    ```
    ## Rename a branch
    1. You are on the branch you want to rename
    `git branch -m new-name`
    2. Delete the old-name remote branch and push the new-name local branch
    `git push origin :old-name new-name`
    3. Reset the upstream branch for the new-name local branch
    `git push origin -u new-name`
  6. marcnewport revised this gist Dec 9, 2019. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion git-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,23 @@
    ## Checkout remote branch
    ### Checkout remote branch
    Fetch the remote branch references
    ```
    git fetch -p
    ```
    Checkout the remote branch
    ```
    git checkout --track origin/remote-branch
    ```

    ### Rename a branch
    You are on the branch you want to rename
    ```
    git branch -m new-name
    ```
    Delete the old-name remote branch and push the new-name local branch
    ```
    git push origin :old-name new-name
    ```
    Reset the upstream branch for the new-name local branch
    ```
    git push origin -u new-name
    ```
  7. marcnewport created this gist Dec 9, 2019.
    5 changes: 5 additions & 0 deletions git-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    ## Checkout remote branch
    ```
    git fetch -p
    git checkout --track origin/remote-branch
    ```