---------------------------------------------
Speaker: There will be 7 instructors for this workshop. Each of us will assist a group of attendants to go through the steps.
Vivian Zhang is organizer of NYC Open Data meetup. She is CTO of a data analytic consulting firm---SupStat Inc.
Amanda Himmelstoss is a recent graduate of the Flatiron School; she works at Blopboard, a social polling platform.
Michael Polycarpou is a ruby on rails developer in one of the startup in NYC. He previously studied EE and love work on hardware design.
David Bella is a ruby on rails developer at XO group. He got Computer Science bachelor degree earlier.
Manley Brendan is working for Running through as a web developer. He got bachelor degree from English major.
Ian Miller is a Ruby developer based in NYC, and has a background in renewable energy project development in developing economies.
Ivan Brennan is a Ruby developer and musician interested in open source collaboration.
Outline:
We will walk you through the basic concept of github, then everyone will be assigned a group and your own TA and learn
1. how to download other people's repositories
2.how to push your own codes to your own repositories.
We will cover five main git commands: git clone,git init, git add, git commit, git push
Please install your git before you come and try to install it. http://git-scm.com/download/mac
---------------------------------------------
Code History and more details: https://github.com/irmiller22/git_workshop/blob/master/git_workshop.md
1) Install Git
1) Install Git:
Go to `http://git-scm.com/downloads`
Follow instructions regarding Git installation (should be included in Git download package)
Set up your Git configuration settings via instructions at `https://help.github.com/articles/set-up-git`
IMPORTANT: When configuring your Git email settings, MAKE SURE IT MATCHES THAT OF YOUR GITHUB ACCOUNT
EMAIL / EMAIL YOU ARE PLANNING TO USE FOR GITHUB ACCOUNT
Ignore the `Password Caching` session for now - you can choose to do this later.
2) Create New Github Profile:
Go to https://github.com/
Create a new account (username, email, password)
When you confirm your account, it will redirect to the home page
Click on the '+' sign next to your username in top right
Select 'New Repository'
Give the repository the name 'git-todo'
3) Open terminal and follow instructions:
cd ~/Desktop
mkdir git-todo
cd git-todo
touch README.md
git init
git add README.md
git commit -m "initial commit"
git remote add origin <paste http:// link here from Github>
git push origin master
cd ~/Desktop
will change directory into our 'Users//desktop' directorymkdir git-todo
will create a new folder called 'git-todo' on your Desktopgit init
creates a new repository in our git-todo
directory. cd git-todo
changes the directory into the git-todo
directory. Think of it as going down one level.touch README.md
generates a markdown file that is called README.git init
initializes, or generates, a new .git
file. Think of a .git
file as the memory store at the root of a directory. The logic that stores your repository data as well as the synchronization between your remote repositories is encapsulated in this .git
file.git add README.md
. You can also add all new/updated files in current directory by doing git add .
, and if you also need to remove files that were deleted, you do git add -A
New Repository
. Then name the repository git-todo
. Then once you have created the repository, copy the HTTPS clone URL in the middle of the screen.git remote add origin https://github.com/<your-username>/git-todo.git
git push origin master
.solutions
branch of the Github repository.https://github.com/irmiller22/git_workshop_test
.https://github.com/<your-username>/git_workshop_test
.git_workshop_test
repository via the HTTPS clone url option in the lower right hand corner of the Github repository screen.cd ~/Desktop
.git clone <paste Github HTTPS URL here>
.ls
to show all files/folders on your Desktop directory. You should see the git_workshop_test
repository here.cd git_workshop_test
assignment.md
file, and follow instructions there.cd
into a the directory you want your project to live in.
On Github, go to the repository you want to contribute to and copy the link on the right hand side of the page.
Back in terminal, and type: git clone <paste http:// link here from Github>
(Note, if this project is something substantial, say an open source project that you would like to contribute to, it's best practices to Fork
the repo to your page and then clone that fork. A fork
is basically copying and pasting the repo.)
Once you've cloned the repo, make the changes you want and then, just like when you initialized a new repo above, stage, commit, and push your changes:
git add <file you've changed>
git commit -m "these are the changes I've made"
git push origin master
Another best practice technique is to make every body of work a separate branch. So far, we've been pushing to the master
branch. You can create your own branching off of the master
branch and do you work on that.
While on master, before you begin working, type: git checkout -b <your-branch-name>
Do your work on this branch, and while on this branch, be sure, like above to stage, commit, and, if you want your teammates to see your work, push your changes up to Github on your new branch:
git add <file you've changed>
git commit -m "these are the changes I've made"
git push origin <your-branch-name>
Note the last command is pushing the changes up to your new branch, not master.
When you're done with your work on your new branch, you may want to merge it into master. There are two ways to do this, either locally (through git on your computer) or remotely (on Github).
Move onto the branch that you want to merge into, in this case, master
: git checkout master
. Then, merge your new branch into master: git merge <your-branch-name>
Now, master is up to date with your changes on your local repo, and you can push
them up to Github.
One arguably better way to handle merging when dealing with a project that multiple people work on is to do all of your work on your new branch, push it up to Github, and then submit a Pull Request
on the site. Here, others can see the merge, and Github can check to make sure there aren't any conflicts.
Here are some other commands to go along with the basic ones we've already covered:
git status
: at any point of your work, if you want to see the status of your repo, type git status
when you're within your project directory to see which files are staged or unstaged.
git pull
: when you're working with other people on a project that's living on Github, most likely they'll be making changes to the code and pushing it up. To bring those changes down to your local repo (on your computer), you will need to pull
them.
git stash
: let's say you've made changes since then that you don't want anymore. Instead of going into your text editor and manually finding the change, you can stash
them and they'll be deleted. Your file will go back to how it was when it was staged last. This is handy, but make sure you absolutely want to do away with your changes before you do this!
Interested in Becoming a Data Scientist?
Then you will want to apply to the NYC Data Science Academy. Classes starting soon.