-
Notifications
You must be signed in to change notification settings - Fork 24
Git and branching
Song Zheng edited this page Jun 5, 2017
·
2 revisions
What happens if you accidentally committed 2 answers into your pull request?
@ColinX13 has a great summary, originally posted for this pull request: https://github.com/llipio/algorithms/pull/48
...Because you have multiple solutions and tests for two questions on one branch you will need to put them on separate branches.
- check your repository with
git remote -v
to see if you have the repository for llipio. If not, you can add it by doinggit remote add llip https://github.com/llipio
. My remote is called llip so I'll use that as an example. - you need to download the code from the remote repository into your computer:
git fetch llip
. - change to a branch that doesn't have changes that you made so you can start clean:
git checkout llip/master
. - create a new branch from there, I'll use h1 as an example
git checkout h1
. - add your changes. My example will be solutions/1.js:
git add solutions/1.js
- create a new commit by
git commit -m 'message'
- make a pull request by
git push origin h1
.
Now, lets say if you want to solve another problem. Here's what you do:
- change to a branch that doesn't have changes that you made so you can start clean:
git checkout llip/master
. - create a new branch from there, I'll use h2 as an example
git checkout h2
.
...
Good luck!