Skip to content

Instantly share code, notes, and snippets.

@arthurattwell
Created May 4, 2020 12:22
Show Gist options
  • Save arthurattwell/74593b4e1d32f42ad5b214803207b001 to your computer and use it in GitHub Desktop.
Save arthurattwell/74593b4e1d32f42ad5b214803207b001 to your computer and use it in GitHub Desktop.
Merge someone's fork of your gist into your gist

How to merge someone's fork of your gist into your gist

I created a gist, then someone else forked it and improved it. With a full repository, I might get their improvements in a pull request. But that isn't availabe for gists.

This is how to get their changes into my gist.

  1. Clone your own gist

     git clone git@gist.github.com:YOUR_GIST_ID_GOES_HERE.git
    
  2. Rename your gist's git folder for easy reference

    See https://www.computerhope.com/issues/ch000846.htm for your OS

    E.g.

     rename "YOUR_GIST_ID_GOES_HERE" "gisty-mcgistface"
    
  3. Change directory to go into that folder

     cd gisty-mcgistface
    
  4. Add their gist as a branch

     git remote add THEIRUSERNAME git@gist.github.com:THEIR_GIST_ID_GOES_HERE.git
     git fetch THEIRUSERNAME
     git checkout -b THEIRUSERNAME-master THEIRUSERNAME/master
    
  5. Switch back to your master branch

     git checkout master
    
  6. Merge their gist into yours

     git merge THEIRUSERNAME-master
    
  7. Push the newly merged gist back to GitHub

     git push
    
@Roy-Orbison
Copy link

You can condense steps 1 & 2 into

git clone git@gist.github.com:YOUR_GIST_ID_GOES_HERE.git DESCRIPTIVE_NAME_OF_GIST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment