- Creating a fork ("version") of my Git repo that is hosted on GitHub on your account
- Creating a new local branch
add_cool_program
off of master - Creating a new file within the
add_cool_program
branch - Commiting the changes, i.e. a new file, within the
add_cool_program
- Merging the changes within the
add_cool_program
branch into themaster
branch - Pushing the changes in your local branch into your remote repository host on GitHub
- Requesting that I merge your changes in your fork of the repo into the original repo
- Fork this project by clicking the Fork button and selecting your account
- Clone the project onto your machine
git clone https://github.com/USERNAME/git-workshop.git
- Go into the cloned directory folder
cd git-workshop
- Create a new branch from master
git branch add_cool_program
- Observe your list of branches
git branch
- Check out the new branch
git checkout add_cool_program
- Write a program that prints out "Hello world" in your favorite language
- Add the file to the stage e.g.
git add HelloWorld.java
- Commit the new file, e.g.
git commit -m "Add hello world program"
- Look at the commit history
git log
- Switch to the master branch
git checkout master
- Merge the
add_cool_program
branch into mastergit merge add_cool_program
- Look at the commit history
git log
- Push your changes to GitHub
git push origin master
- Delete your merged branch
git branch -d add_cool_program
- On your git-workshop fork GitHub page, github.com/USERNAME/git-workshop, select New pull request
- Select the green button that says Create pull request
- Confirm the pull request
Don't forget to use git status
before each of the commands as a sanity check