-
Notifications
You must be signed in to change notification settings - Fork 2
GitHub branch
Instructions:
Part I: Branching and Submitting a Pull Request
In this section we will create a branch, add a feature, and submit a pull request. Only one group member should complete this section, everyone else should observe.
Clone the project repo onto your computer and cd into it.
Run the following command in your terminal to create and checkout to a new branch:
git checkout -b add-yourBranch
You should now be on a new branch named "add-yourBranch". In order to verify this worked, run the following command in your terminal:
git branch
You should see two branches listed: master and add-yourBranch. The add-yourBranch branch should have an asterisk to the left of it. This indicates that this is the branch you're currently on.
Make the desired changes
In your terminal, add and commit the changes. Then push up your code by running following in your terminal:
git push origin add-yourBranch
This should push up your code to to GitHub on a branch with the same name (add-yourBranch).
Go to the main repo page at github.com and you should see an button that says "Compare & pull request" -- click this.
On the next screen, add a description of the work that was done in the textarea and click the "Pull Request" button.
If completed successfully, you should see the pull request listed under the repo's "Pull request" tab.
Part II: Reviewing a Pull Request
In this section we will review the pull request from Part I and merge it into master. A different project member should complete this section while others observe.
Clone the repo to your computer if you haven't already done so and cd into it.
First you will want to test the changes introduced by the add-yourBranch branch locally.In order to examine the new branch on your local machine, run the following commands in your terminal:
git fetch
git checkout -b add-yourBranch origin/add-yourBranch
This code should bring the copy of the add-yourBranch branch that's on GitHub onto your computer.
Make sure this worked by verifying that there's an index.html file in your local repo.
Normally you'd run the code here to make sure everything works properly.
Check back out to your local master branch by running the following in your terminal:
git checkout master
Now go to your GitHub repo's main page and go to the "Pull request" section. Select the add-yourBranch pull request from the list.
At the next page select the option to see the "Files changed".
You should be presented with all of the files that were changed in this PR along with line numbers for any code added/removed.
If there are any changes you would like made, you can click the line number to leave a comment the PR author will see and should address before approval. Otherwise click "Review changes" and approve the PR. You should be taken to a screen with an option to "Merge pull request" -- click this button.
Once complete you can delete the feature branch from your machine by running the following in your terminal:
git branch -D add-yourBranch Github changes Save off project-2 folder to another folder on computer Delete project-2 folder & remove from recycle bin Cd to project-2 folder git clone git@github.com:missybarringer/Project-2.git cd project-2 git checkout -b add-yourBranch Switched to a new branch 'add-yourBranch' git status git add . git commit -m "added yourBranch" git push --set-upstream origin add-yourBranch
git push --set-upstream origin add-yourBranch Enumerating objects: 15, done. Counting objects: 100% (15/15), done. Delta compression using up to 4 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (8/8), 976 bytes | 976.00 KiB/s, done. Total 8 (delta 3), reused 0 (delta 0) remote: Resolving deltas: 100% (3/3), completed with 3 local objects. remote: remote: Create a pull request for 'add-datepicker' on GitHub by visiting: remote: https://github.com/missybarringer/Project-2.git/pull/new/add-yourBranch remote: To github.com/missybarringer/Project-2.git
- [new branch] add-yourBranch -> add-yourBranch Branch 'add-yourBranch' set up to track remote branch 'add-yourBranch' from 'origin'.