Skip to content

Instantly share code, notes, and snippets.

@brianddk
Created April 5, 2015 23:54
Show Gist options
  • Select an option

  • Save brianddk/24e0e5766acf1e29daec to your computer and use it in GitHub Desktop.

Select an option

Save brianddk/24e0e5766acf1e29daec to your computer and use it in GitHub Desktop.
All Gist in One folder

How to put one gist in one branch

I have been trying to learn git, so I gave myself a number of challenges. This challenge was to have all of my Gists in one git controlled directory called 'gist', without having to merge all of them checked out.

Init gist directory

Do a git init to init gist directory

$ mkdir gist
$ cd gist
$ git init
Set up remotes

Next I will set up a remote for a few of my favorite gists

$ git remote add rServerLess https://gist.github.com/a5ef486532155fd99795.git
$ git remote add rGistApi https://gist.github.com/fb5a7e4b55e323b83745.git
$ git remote add rPoshTemp https://gist.github.com/5775c7beef50acc619b4.git
Fetch all the remotes

Next I need to fetch the master branch for each remote

$ git fetch rServerLess
$ git fetch rGistApi
$ git fetch rPoshTemp
Checkout remote\master to it's own branch

Now that I have all the remotes, I will create a branch for each

$ git checkout -b bServerLess rServerLess/master
$ git checkout -b bGistApi rGistApi/master
$ git checkout -b bPoshTemp rPoshTemp/master
Workflow pull / edit / push

Now lets do some work. I'll add a file to one of the gists

$ git checkout bPoshTemp
$ git pull rPoshTemp master
$ echo d4n13 > AUTHORS
$ git add AUTHORS
$ git commit -m "give myself credit"
$ git push rPoshTemp bPoshTemp:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment