When you set up git on your machine, there are a couple of configuration options you should use. You can run
git config -l --global
to see if these are set.
You should see:
user.email=<your email address> user.name=<your github ID>
And perhaps other values. If you do not see these values do:
git config --global user.email <your email address> git config --global user.name <your github ID>
Recommended Additional Configuration for Windows
You should also make sure git processes line ends correctly on Windows. You should do:
git config --global core.autocrlf input git config --global core.eol lf
Recommended Git Flow for Code the Dream Class Exercises
- cd ~/lessons
- git clone <repository url>
- cd <directory for the cloned repository>
- git checkout -b <new branch name>
- Edit your files as needed for the lesson
- Save your files
- Test and modify as necessary
- git status
- git add -A
- git status
- git commit -m “<some meaningful commit message>”
- git push origin <new branch name>
- Go to github for your repository. Create a pull request for your branch
- Accept/merge the pull request, again on github, to merge into the master branch
- Go back to your workspace. Close the files in the editor if you haven’t already
- git checkout master
- git pull origin master
If you forget and start to do your editing in the master branch, you can do a git stash to store your edited files. That will restore the state of the master branch. You can then create your new branch and do git stash apply to get your edits back.
Remember to close the files in the editor before switching between branches with git checkout, or you may get mixed up.
You could delete the new branch after it is merged with the master, but it is not necessary or recommended to do so for CTD exercises.