Skip to content

Instantly share code, notes, and snippets.

@sgnl
Last active October 3, 2023 22:51
Show Gist options
  • Select an option

  • Save sgnl/b8df35ae166223cebf85 to your computer and use it in GitHub Desktop.

Select an option

Save sgnl/b8df35ae166223cebf85 to your computer and use it in GitHub Desktop.

Revisions

  1. sgnl revised this gist Oct 8, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,8 @@ At this point you may watch to checkout to your newly create branch and issue a
    1. `git pull`
    1. `git checkout master`
    1. `git merge [maintainer's name]_[branch]`


    ====

    # You've Forked Up

  2. sgnl revised this gist Oct 8, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    #tl;dr

    ## setting up a branch to track a repo

    _pre_: assuming you have forked a repo and cloned your fork to your computer

    1. `git remote add [maintainer's name] [paste URL here]`
    1. `git fetch --all`
    1. `git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]`
  3. sgnl revised this gist Oct 8, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    #tl;dr

    _pre_: assuming you have forked a repo and cloned your fork to your computer

    ## setting up a branch to track a repo
    _pre_: assuming you have forked a repo and cloned your fork to your computer
    1. `git remote add [maintainer's name] [paste URL here]`
    1. `git fetch --all`
    1. `git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]`
  4. sgnl revised this gist Oct 8, 2015. 1 changed file with 13 additions and 8 deletions.
    21 changes: 13 additions & 8 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,18 @@
    #tl;dr

    pre: assuming you have forked a repo and cloned your fork to your computer
    1. git remote add [maintainer's name] [paste URL here]
    2. git fetch --all
    3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]
    4. git checkout [maintainer's name]_[branch]
    5. git pull
    6. git checkout master
    7. git merge [maintainer's name]_[branch]
    _pre_: assuming you have forked a repo and cloned your fork to your computer

    ## setting up a branch to track a repo
    1. `git remote add [maintainer's name] [paste URL here]`
    1. `git fetch --all`
    1. `git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]`
    At this point you may watch to checkout to your newly create branch and issue a `git pull` command.

    ## Fetching updates from the maintainer's repo
    1. `git checkout [maintainer's name]_[branch]`
    1. `git pull`
    1. `git checkout master`
    1. `git merge [maintainer's name]_[branch]`


    # You've Forked Up
  5. sgnl revised this gist Oct 8, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    #tl;dr

    pre: assuming you have forked a repo and cloned your fork to your computer
    1. git remote add [maintainer's name] [paste URL here]
    2. git fetch --all
    3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]
  6. sgnl revised this gist Oct 8, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ Make sure to run the fetch command, fetch goes and updates the history of a cert
    git fetch jquery_origin

    # Add Tracking Branch (step 3)
    _before_: run the command `git fetch --all`
    Our convention is to name the branch with the [maintainer's name] and a `_[branch]` suffix.

    git branch --track jquery_master jquery_origin/master
  7. sgnl revised this gist Oct 8, 2015. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,12 @@
    #tl;dr

    1. git remote add [maintainer's name] [paste URL here]
    2. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]
    3. git checkout [maintainer's name]_[branch]
    4. git pull
    5. git checkout master
    6. git merge [maintainer's name]_[branch]
    2. git fetch --all
    3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]
    4. git checkout [maintainer's name]_[branch]
    5. git pull
    6. git checkout master
    7. git merge [maintainer's name]_[branch]


    # You've Forked Up
  8. sgnl revised this gist Oct 8, 2015. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    #tl;dr

    git remote add [maintainer's name] [paste URL here]
    git branch --track [maintainer's name]_[branch] [remote name from step 2]/[branch you want to track]
    git checkout [maintainer's name]_[branch]
    git pull
    git checkout master
    git merge [maintainer's name]_[branch]
    1. git remote add [maintainer's name] [paste URL here]
    2. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track]
    3. git checkout [maintainer's name]_[branch]
    4. git pull
    5. git checkout master
    6. git merge [maintainer's name]_[branch]


    # You've Forked Up
  9. sgnl revised this gist Feb 27, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ Make sure to run the fetch command, fetch goes and updates the history of a cert
    # Add Tracking Branch (step 3)
    Our convention is to name the branch with the [maintainer's name] and a `_[branch]` suffix.

    git branch --track jquery_origin/master jquery_master
    git branch --track jquery_master jquery_origin/master

    #### command break down

  10. Ray Farias revised this gist Jan 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -67,5 +67,5 @@ You should see some changes mentioned in the Terminal.

    Now checkout to your own local working branch and merge in the changes from your branch original repo tracking branch.

    ### Last Words
    # Last Words
    Once you have done all these steps for one repo, to get updates in the future all you need to do is *Steps 4 & 5*. If you have a new project, you *MUST* do all the steps over again to set up a tracking branch, new origin, etc.
  11. Ray Farias revised this gist Jan 28, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -65,4 +65,7 @@ You should see some changes mentioned in the Terminal.

    # Merge Upstream's commits (Step 5)

    Now checkout to your own local working branch and merge in the changes from your branch original repo tracking branch.
    Now checkout to your own local working branch and merge in the changes from your branch original repo tracking branch.

    ### Last Words
    Once you have done all these steps for one repo, to get updates in the future all you need to do is *Steps 4 & 5*. If you have a new project, you *MUST* do all the steps over again to set up a tracking branch, new origin, etc.
  12. Ray Farias revised this gist Jan 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -65,4 +65,4 @@ You should see some changes mentioned in the Terminal.

    # Merge Upstream's commits (Step 5)

    Now checkout to your own, local, working branch and merge in the changes from your branch original repo tracking branch.
    Now checkout to your own local working branch and merge in the changes from your branch original repo tracking branch.
  13. Ray Farias revised this gist Jan 28, 2015. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,13 @@
    #tl;dr

    git remote add [maintainer's name] [paste URL here]
    git branch --track [maintainer's name]_[branch] [remote name from step 2]/[branch you want to track]
    git checkout [maintainer's name]_[branch]
    git pull
    git checkout master
    git merge [maintainer's name]_[branch]


    # You've Forked Up

    These are notes for someone who has forked a Repository(Repo) on Github and would like to update their forked copy with updates from the Original Repo.
  14. Ray Farias revised this gist Jan 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ Our convention is to name the branch with the [maintainer's name] and a `_[branc

    #### command break down

    git branch --track [remote name from step 2]/[branch you want to track] [maintainer's name]_[branch]
    git branch --track [maintainer's name]_[branch] [remote name from step 2]/[branch you want to track]

    #### Before moving on...

  15. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 0 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -11,8 +11,6 @@ From here on out I will refer to the Original Repo as `Maintainer's ...`.
    # Be Clean (step 1)
    `git status` to ensure that you are working _clean_ and can run the commands below. If your repo is not _clean_ please do all the steps needed to get clean (e.g. commit, stash).

    ====

    # Add Original Repo's HTTPS URL (step 2)
    Go to the Original Repo's Github page and get the `https` Clone URL. It should look something like `https://github.com/jquery/jquery.git`

    @@ -33,8 +31,6 @@ Make sure to run the fetch command, fetch goes and updates the history of a cert

    git fetch jquery_origin

    ====

    # Add Tracking Branch (step 3)
    Our convention is to name the branch with the [maintainer's name] and a `_[branch]` suffix.

    @@ -48,8 +44,6 @@ Our convention is to name the branch with the [maintainer's name] and a `_[branc

    git checkout [maintainer's name]_[branch]

    ====

    # Update Upstream's Master (Step 4)
    Now that you've added a remote, created a new branch, and set that it (your newly created branch) to track a branch on the Original Repo. Now you can pull down changes!

    @@ -59,8 +53,6 @@ Now that you've added a remote, created a new branch, and set that it (your newl

    You should see some changes mentioned in the Terminal.

    ====

    # Merge Upstream's commits (Step 5)

    Now checkout to your own, local, working branch and merge in the changes from your branch original repo tracking branch.
  16. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -46,7 +46,7 @@ Our convention is to name the branch with the [maintainer's name] and a `_[branc

    #### Before moving on...

    git checkout []
    git checkout [maintainer's name]_[branch]

    ====

  17. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,6 @@ Our convention is to name the branch with the [maintainer's name] and a `_[branc

    git checkout []


    ====

    # Update Upstream's Master (Step 4)
    @@ -60,7 +59,6 @@ Now that you've added a remote, created a new branch, and set that it (your newl

    You should see some changes mentioned in the Terminal.


    ====

    # Merge Upstream's commits (Step 5)
  18. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 38 additions and 4 deletions.
    42 changes: 38 additions & 4 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,8 @@ From here on out I will refer to the Original Repo as `Maintainer's ...`.
    # Be Clean (step 1)
    `git status` to ensure that you are working _clean_ and can run the commands below. If your repo is not _clean_ please do all the steps needed to get clean (e.g. commit, stash).

    ====

    # Add Original Repo's HTTPS URL (step 2)
    Go to the Original Repo's Github page and get the `https` Clone URL. It should look something like `https://github.com/jquery/jquery.git`

    @@ -23,12 +25,44 @@ With the URL copied to your clipboard. Run the command below in your Terminal. H
    #### command break down

    git remote add [maintainer's name] [paste URL here]

    ## After you have added a new remote
    Make sure to run the fetch command, fetch goes and updates the history of a certain remote ([and so much more](http://git-scm.com/docs/git-fetch))

    # Add tracking Branch
    #### using the example with jquery from above

    git fetch jquery_origin

    ====

    # Add Tracking Branch (step 3)
    Our convention is to name the branch with the [maintainer's name] and a `_[branch]` suffix.

    git branch --track jquery_origin/master jquery_master

    #### command break down

    git branch --track [remote name from step 2]/[branch you want to track] [maintainer's name]_[branch]

    #### Before moving on...

    git checkout []


    ====

    # Update Upstream's Master (Step 4)
    Now that you've added a remote, created a new branch, and set that it (your newly created branch) to track a branch on the Original Repo. Now you can pull down changes!

    #### run the command

    git pull

    You should see some changes mentioned in the Terminal.


    ====

    # Update Upstream's Master
    # Merge Upstream's commits (Step 5)

    # Merge Upstream's commits
    Now checkout to your own, local, working branch and merge in the changes from your branch original repo tracking branch.
  19. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,9 @@ With the URL copied to your clipboard. Run the command below in your Terminal. H
    #### command break down

    git remote add [maintainer's name] [paste URL here]

    ## After you have added a new remote
    Make sure to run the fetch command, fetch goes and updates the history of a certain remote ([and so much more](http://git-scm.com/docs/git-fetch))

    # Add tracking Branch

  20. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 2 additions and 6 deletions.
    8 changes: 2 additions & 6 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -16,18 +16,14 @@ Go to the Original Repo's Github page and get the `https` Clone URL. It should l

    With the URL copied to your clipboard. Run the command below in your Terminal. Here at DevLeague we prefer giving our tracking remote a name that includes the Original Repo's name followed by a `_origin` suffix.

    Here is an example using the jQuery repo
    #### Here is an example using the jQuery repo

    git remote add jquery_origin https://github.com/jquery/jquery.git
    git remote add jquery_origin https://github.com/jquery/jquery.git

    #### command break down

    git remote add [maintainer's name] [paste URL here]


    ###


    # Add tracking Branch

    # Update Upstream's Master
  21. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,13 @@ From here on out I will refer to the Original Repo as `Maintainer's ...`.
    # Add Original Repo's HTTPS URL (step 2)
    Go to the Original Repo's Github page and get the `https` Clone URL. It should look something like `https://github.com/jquery/jquery.git`

    With the URL copied to your clipboard. Run the command below in your Terminal, replace [maintainer's name] with the maintainer's name.
    With the URL copied to your clipboard. Run the command below in your Terminal. Here at DevLeague we prefer giving our tracking remote a name that includes the Original Repo's name followed by a `_origin` suffix.

    ### for example
    Here is an example using the jQuery repo

    git remote add jquery_origin https://github.com/jquery/jquery.git

    #### command break down

    git remote add [maintainer's name] [paste URL here]

  22. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,22 @@ For example, Let's imagine that I have cloned jQuery to my Github Account. A few

    The steps below outline how to set up a branch, add a new `remote` which points to the Original Repo, and then set up the branch to track the Original Repo, for easier and quicker updates. These steps are performed in your command-line interface and once set-up for a project, it takes at least 4 commands to update and merge in changes.

    From here on out I will refer to the Original Repo as `Maintainer's ...`.

    # Be Clean (step 1)
    `git status` to ensure that you are working _clean_ and can run the commands below. If you not _clean_ please do all the steps needed to get clean (e.g. commit, stash)
    `git status` to ensure that you are working _clean_ and can run the commands below. If your repo is not _clean_ please do all the steps needed to get clean (e.g. commit, stash).

    # Add Original Repo's HTTPS URL (step 2)
    Go to the Original Repo's Github page and get the `https` Clone URL. It should look something like `https://github.com/jquery/jquery.git`

    With the URL copied to your clipboard. Run the command below in your Terminal, replace [maintainer's name] with the maintainer's name.

    ### for example

    git remote add [maintainer's name] [paste URL here]


    # Add Maintainer's Origin
    ###


    # Add tracking Branch
  23. Ray Farias revised this gist Jan 27, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,12 @@
    # You've Forked Up

    These are notes for someone who has forked a Repository(Repo) on Github and would like to update their forked copy with updates from the Original Repo.

    For example, Let's imagine that I have cloned jQuery to my Github Account. A few days later through some notifications, jQuery has updated the Repo with new code, after some review I decide that I want this code. People new to Github/Git would delete the fork that is on their own account, then just Fork the Repo again. While this would work, it is extremely uncool (we want to be cool, right?).

    The steps below outline how to set up a branch, add a new `remote` which points to the Original Repo, and then set up the branch to track the Original Repo, for easier and quicker updates.
    The steps below outline how to set up a branch, add a new `remote` which points to the Original Repo, and then set up the branch to track the Original Repo, for easier and quicker updates. These steps are performed in your command-line interface and once set-up for a project, it takes at least 4 commands to update and merge in changes.

    # Be Clean
    # Be Clean (step 1)
    `git status` to ensure that you are working _clean_ and can run the commands below. If you not _clean_ please do all the steps needed to get clean (e.g. commit, stash)

    # Add Maintainer's Origin
  24. Ray Farias created this gist Jan 27, 2015.
    17 changes: 17 additions & 0 deletions add-upstream.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    These are notes for someone who has forked a Repository(Repo) on Github and would like to update their forked copy with updates from the Original Repo.

    For example, Let's imagine that I have cloned jQuery to my Github Account. A few days later through some notifications, jQuery has updated the Repo with new code, after some review I decide that I want this code. People new to Github/Git would delete the fork that is on their own account, then just Fork the Repo again. While this would work, it is extremely uncool (we want to be cool, right?).

    The steps below outline how to set up a branch, add a new `remote` which points to the Original Repo, and then set up the branch to track the Original Repo, for easier and quicker updates.

    # Be Clean
    `git status` to ensure that you are working _clean_ and can run the commands below. If you not _clean_ please do all the steps needed to get clean (e.g. commit, stash)

    # Add Maintainer's Origin


    # Add tracking Branch

    # Update Upstream's Master

    # Merge Upstream's commits