-
Notifications
You must be signed in to change notification settings - Fork 8
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
p1
branch, and it has 2 uncommitted changes -
We then create a new branch with
git checkout p2
orgit 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 stash
in the branch you're on to store the changes - Run
git switch master
to go back to themaster
branch - Run
git branch -D <WRONG_BRANCH_NAME>
to delete the wrong branch (in the example, it'sp2
)-
-D
meansDelete
-
- Run
git switch -c <BRANCH_NAME>
to create the branch again-
-c
meanscreate
-
- Run
git stash pop
to 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 branch
and make sure the star is next tomaster
- If it's not, run
git switch master
to switch tomaster
- If it's not, run
- Run
git switch -c <BRANCH_NAME>
- Run