First make sure you're on your master branch. (git checkout master
)
$ git pull upstream master
$ git push origin master
$ git checkout -b branch_name
$ git add file_name
or $ git rm file_name
Tip: use
git status
to see which files you modified, then just copy and paste them. If using Cloud9, you can click on each file that appears when you type$ git status
and selectgit add
Important: Don't use
$ git add .
!
$ git commit -m "Brief description of changes"
$ git pull upstream master
$ git push origin BRANCH_NAME
Note that you must use the name of the branch that you are working on here. If you are working on branch_A and you type git push origin master
, you're likely to see something like "Everything up-to-date." That's because your changes were made on the branch you created, and your master hasn't been altered.
Go to https://github.com/YOUR_USER_NAME/REPO_NAME
and you will see a prompt to send a PR right above the file directory. Follow the instructions on the screen.
Tip: When sending a PR, add notes about what you want reviewers to pay attention to, ask questions, note limitations, and feel free to annotate your own code. Whenever pertinent, add screenshots and explain the program's desired behavior. Read more about PRs
If you're an admin in one of your organization's repo, you should receive an email notification whenever someone sends out a pull request.
In your local environment, commit your changes before pulling your friend's code (no need to push, though you can).
You'll find a link in the email, but you can also go to the base repo page >> Pull Requests
Follow the command-line instructions
onscreen to pull the code locally. They will be available on the "Conversation" tab, just above the box where you can enter comments. These instructions will look like this:
Step 1: From your project repository, check out a new branch and test the changes.
$ git checkout -b YOUR_FRIENDS_USERNAME-BRANCH_NAME master
$ git pull git://github.com/YOUR_FRIENDS_USERNAME/REPO_NAME.git BRANCH_NAME
This will pull your friend's changes into a separate branch, so you can test their code without having it interfere with your own. Once you're done testing, you can delete that branch using $ git branch -d BRANCH_NAME
and go back to your work with $ git checkout BRANCH_THAT_YOU_WERE_WORKING_ON
If you have suggestions or requests, add comments, inline and otherwise.
If there are conflicts, github will not let you merge. Either click on Resolve conflicts
or comment on the thread asking your friend to pull from upstream and resolve the conflicts. Note that, when your friend make any changes and pushes from that same branch, the PR will be updated automatically.
If everything looks good, follow the instructions on the screen to merge. In other words, if there are no conflicts, there should be a big green button that says Merge pull request
. Click that and confirm the merge.
First things first! Configure your machine with your GitHub user
- Open Terminal.
- Enter
git config --global user.email "your_email_address@your_email_server.com"
- Enter
git config --global user.name "your_name"
To learn more, check out Setting your email in Git
Go to https://github.com/MissionBit/REPO_NAME and click Fork
on the top right.
Wait. When the forking is done, you'll be redirected to your remote repo, which is a copy of the base repo you just forked.
From your remote repo (the address bar will display https://github.com/YOUR_USER_NAME/REPO_NAME
, find a green button that says "Clone or download." Click this button and copy the link, which will be something like: git@github.com:YOUR_USER_NAME/REPO_NAME.git
You can either use HTTPS and enter your username/password everytime you push, or you can configure ssh access. If you choose the latter, remember to revoke the Mission Bit computer access after the end of this class.
Open your terminal and navigate to Desktop > Projects. Type git clone
followed by the link we just copied.
git clone git@github.com:YOUR_USER_NAME/REPO_NAME.git
Go to https://github.com/MissionBit/REPO_NAME and find the green button that says "Clone or download." Click this button and copy the link, which will be something like: git@github.com:MissionBit/REPO_NAME.git
Back in your terminal, type git remote add upstream git@github.com:MissionBit/REPO_NAME.git
. Hit enter.