-
Notifications
You must be signed in to change notification settings - Fork 9
Students issues
Flacial edited this page Jul 19, 2022
·
3 revisions
About: This page list solutions for most issues students may encounter
Example of when it might happen:
-
We're in
p1branch, and it has 2 uncommitted changes -
We then create a new branch with
git checkout p2orgit switch -c p2
Why is it an issue?
- Checking out from a branch other than master might cause possible issues like submitting multiple unintended files caused by the changes from the previous branch (
p1) being added to the new branch (p2).
How to fix it?
- Run
git stashin the branch you're on to store the changes - Run
git switch masterto go back to themasterbranch - Run
git branch -D <WRONG_BRANCH_NAME>to delete the wrong branch (in the example, it'sp2)-
-DmeansDelete
-
- Run
git switch -c <BRANCH_NAME>to create the branch again-
-cmeanscreate
-
- Run
git stash popto restore your changes
What should I do so it won't happen again?
- You'll have to checkout from master whenever you try to solve a new challenge
- Run
git branchand make sure the star is next tomaster- If it's not, run
git switch masterto switch tomaster
- If it's not, run
- Run
git switch -c <BRANCH_NAME>
- Run