Programming resources for FIRST Robotics team 1318
When working with branches, you will typically follow a workflow like below:
git checkout master. This will fail if you have pending changes. If you don’t have any pending changes you care about, you can run git clean -d -f. If that doesn’t solve the problem, run git stash. If you have changes you care about from a previous topic branch, see step 5 and come back here after step 7 or 8. If you started making changes before following these steps, see So you started coding before creating a topic branch below.git pull.git checkout -b topicbranchname (don’t forget to replace topicbranchname!).git commit -a -m "description of my change".git push. You will probably get a message saying that your topic branch isn’t being tracked upstream. You can either copy and paste the message it gives you, or run something like git push --set-upstream origin topicbranchname (don’t forget to replace topicbranchname!).If you started coding in “the wrong branch,” you can usually recover as long as you don’t have changes from another topic branch mixed in. You can do something like:
git stash.git checkout master.git pull.git checkout -b topicbranchname (don’t forget to replace topicbranchname!).git stash pop.