-
Notifications
You must be signed in to change notification settings - Fork 164
Don't delete completed labs
If you follow the instructions for the github PR process, it is easy to accidentally submit a PR that deletes another persons merged lab solution.
git checkout master
git pull upstream master
git checkout feature
git rebase master # merged labs will appear in your branch here
# Delete other peoples' lab directories
git push -f
This is the same as the go-course PR instructions, with the deleting of other peoples labs that can come between the rebase
and the push
.
This is easy to do accidentally since this is a spot where some work can be done, and if done in an IDE, can make it annoying to see other peoples labs pop up.
- Don't delete other peoples labs on your machine. You won't even notice the new labs if you work mainly in the terminal, but in an IDE you will see more and more lab solutions pop up over time, which is annoying and can make it tempting to delete them.
- Only commit changes to your lab directory. You can commit specific files with
git add lab/username
to add only changes in your lab. You can also check what will get committed withgit status
before a commit.
The best way to undo a commit is to rebase your good commits.
- First use
git log
or inspect your branch on GitHub to find the bad commit - Then on your branch, do the following
git rebase --onto commit-before-bad bad-commit branch-name
This will rebase your branch onto the last good commit and copy all your commits except the bad commit. You can read more about how this command works here. You will lose any changes you made on the bad commit, and will need to add, commit and push them again.