slides: http://cherimarie.github.io/gdi-2day-core-git-github
Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.
Some "rules"
Give it the same name as one of the repositories on your computer.
While a README isn't a required part of a GitHub repository, it is a very good idea to have one. READMEs are a great place to describe your project or add some documentation such as how to install or use your project. You might want to include contact information - if your project becomes popular people will want to help you out.
Copy SSH link from Github repo
# from inside your local git repo
git remote add origin [pasted link from Github]
git pull origin master
#pull first, when the remote repo has a readme
git push origin master
#push your local work to the repo
If you are working with a team, you want to make sure that you have everyone's changes before pushing your changes to the GitHub repo
#pull current state from Github
git pull origin master
# fix any conflicts (see merge conflicts above) and commit
# then, push local changes to GitHub
git push origin master
As you make changes locally, push to Github.
Make a change to your README file, then add and commit it. Then, push!
git push origin master
Go check out your Github repo online to see your changes.
When you push and pull, the command includes the name of the branch. If you're working on "feature" branch, make sure you push and pull to "feature".
git pull origin feature
git push origin feature
If there are branches available on Github repo that are not in your local repo, fetch from Github, then you'll be able to check them out locally.
git fetch origin
From github.com:org_name/project
b3d8ce0..0754251 master -> origin/master
* [new branch] rad_feature -> origin/rad_feature
git checkout rad_feature
Cloning allows you to recreate a Github repository to your computer, really simply!
Find this link on the lower right of the repo's Github page, and copy it.
Navigate to the location you want new directory to be in on your computer- NOT INSIDE ANOTHER GIT REPO! Then, clone to get a local repository of your fork.
git clone [pasted link]
cd [repo name]
The 'git clone' command does a lot!
Go to https://github.com/cherimarie/GitResources and hit the fork button.
Clone your forked repo to your computer.
Add a remote connection to the original repository, so you can stay up to date with their changes:
git remote add upstream https://github.com/original-username/FORKED-REPO-NAME.git
# creates a remote connection, called "upstream", to the original repo on Github
git fetch upstream
# Pulls in changes not present in your local repository, without modifying your files
git add .
git commit -m "Add great new resource"
git push origin master
Visit your Github repo page
Fill out the form with a polite, helpful description, and submit.
How to manage pull requests is out of the scope of this short workshop, but you can learn more from the Github Collaborating Tutorials
Cheri Allen
@cherimarie