Reputation: 13310
I have created a branch from master, made my changes and am now ready to commit and push back to remote master.
Do I first need to commit my changes to my local branch
git commit -m "new changes, etc."
then
git push
to push to the remote?
Is this first part correct?
Then How do I make a pull request?
Upvotes: 0
Views: 548
Reputation: 496
Before you do anything, you should be aware that to perform a pull request, you have to do your work in a branch separate from your desired branch. Branches are super lightweight in git, and you should use them all the time. To create and switch over to a new branch, first do git branch <new branch name>
, and then check it out using git checkout <new branch name>
. Your new branch is created based on your current branch (so if you are going to make another new one that you want based on master, make sure you switch back to master first).
To commit, you need to first add the files you'd like to commit to the staging area. Do this with git add <filename>
. If you'd like to add all the files you see when calling git status
, you can just do git add .
.
Next you can do your commit. I personally prefer to not add the message on the command-line for large changes, because I like to have one extra screen showing me everything that's getting committed and what specifically isn't. I think the default editor is vi, but if you don't feel comfortable with vi, you can specify the editor through git config --global core.editor <your favorite editor>
.
You're now ready to push to github! Do it! git push
Now you're ready to set up your pull request. Head to github and find your repo. Hit the pull request button. You have two important drop downs now. The box on the left is the TARGET branch. The box on the right is the SOURCE branch. Set the left to master, and the right to your new branch. Add a comment, review everything, then hit send pull request. Ba-bam.
Check out this link on github for more info and some handy screen shots: https://help.github.com/articles/creating-a-pull-request
Upvotes: 1