Skip to content

github commands I’ve been using recently.

September 30, 2012

The documentation for github is a little too cryptic for my liking.  Finding some of the information I’ve been searching for has taken a little while when it should take no more than a minute or two to find.

Obviously you have the set of commands to push your changes to githubs servers.  Just for quick reference these are:

git add .
git commit -m "Description of changes."
git push origin master

Your passphrase will follow.  In the first command, note the period. That means that git will track all the files in your project.  If there are files you don’t want tracked, you should add a .gitignore file.  If you add a file to your repo THEN add a .gitignore set to ignore the file, it won’t take. You will need to manually remove the file from the github repo.  Do that with

git rm filename
git commit -m "The changes."
git push origin master

And finally, if one of your changes includes a deleted file, you will need to add the option -A to your add.

git add -A .
git commit -m "The changes."
git push origin master

That is about it for now. I am still experimenting and github is very new to me.  Please note that none of the above will retroactively remove a file. If you added a sensitive file by mistake you’ll need figure out how to remove the file/data from previous commits.  I hear that this can really mess up repos so be careful anytime you may add senstive data to your projects.  Double note that any of the information on this blog may be wrong or there may be a much better way of achieving the results.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: