Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github committing (push) gist

Tags:

git

github

gist

I cannot understand this.

I have created a gist. Then I run

$ mkdir mygist $ cd mygist $ git init $ git pull [email protected]:869085.git

Then I add files, change files and try to commit.

$ git add . $ git commit -a -m "Better comments"

Then I do not know how to send it back to github and commit this git.

like image 546
Sergey Avatar asked Mar 14 '11 13:03

Sergey


People also ask

Can you fork a gist?

Gists are actually Git repositories, which means that you can fork or clone any gist, even if you aren't the original author.

Can I clone a gist?

With the URL in your clipboard, open the Gist Dev menu and select the Clone a Gist Repository item. You will then be presented with an input field where you can paste the URL copied from GitHub. Click the Clone button or press enter, and the repository will be cloned to your computer.


1 Answers

It's probably easiest if you just start by cloning the gist, so that origin (a "remote" that refers to the original repository) is set up for you. Then you can just do git push origin master. For example:

git clone [email protected]:869085.git mygist cd mygist # Make your changes... git add . git commit -m "Better comments" git push origin master 

However, if you don't want to redo your changes, you can do:

cd mygist git remote add origin [email protected]:869085.git git fetch origin # Push your changes, also setting the upstream for master: git push -u origin master 

Strictly speaking, the git fetch origin and -u argument to git push origin master are optional, but they will helpfully associate the upstream branch master in origin with your local branch master.

like image 188
Mark Longair Avatar answered Sep 20 '22 12:09

Mark Longair