Version control
Video
Slides
Exercise
After moving files into your repository, run
git status
to see what Git thinks has changed.Please note: are there (temporary) files you do not wish to track? Add them to the
.gitignore
file. Consider a.gitignore
template for your language: examples on this github repo.Run
git add
to stage the changes, usegit status
to check what has happened.Run
git commit
to add the changes to you git project history and use a descriptive commit message.Run
git log
to see the history of your project.
Your changes are now saved in your local (on your PC) repository. You still need to push the changes to GitHub. Run git push
to do this.
Can you use Git and push to Github from your IDE?
Experiment with editing and committing on GitHub itself (e.g. add something to the README file). You can then ‘download’ your changes to your local repository using
git pull
.Run
git log
again to see the history of your project.Optional: What happens if you edit the same file online and locally, and try to push/pull? (Hint: this often causes a ‘merge conflict’, which is no fun to experience. Going through it today means we can assist you if necessary!)