Git Cheat Sheet
If you've already used a Distributed Versioning Control System, you should be familiar with what follows. If not, then this page might help you get started.
Install Git
$ sudo apt-get install git
Clone the Repository
$ git clone https://github.com/WiseEarthTechnology/CrisisCommunicator-Challenge
Note that you should create your own repository on GitHub, or BitBucket, or similar, and pull from our repository into yours. Do not commit changes to our repository!
A few things before committing anything to a repository:
1. Set your git settings first
$ git config --global user.name '<your name>'
$ git config --global user.email <email>
2. Always make a pull before a push
To pull:
$ git pull
To push:
$ git push origin master
3. Commiting
If you create or add files to a folder, add them to git's tracking using
$ git add <folder/file>
While committing files, its better to specify the specific files you are commiting
$ git commit <file1> <file2> ...
Also, make the first line of the commit message short and meaningful. The lines following can be longer. (e.g. Fixed buffer overflow issue in Missing.findMaxPersons())
Also, make sure to make atomic (small, contained) commits, and make sure your code isn't broken!
4. Check what files are changed
$ git status
It lets you know what files are changed/removed and what files are untracked by git
5. Check history of commits
$ git reflog
6. Discard all changes since the last commit
$ git reset --hard HEAD
This is useful in case you try some experiment, but it ends up breaking a lot of stuff, so u just revert back to the last sane state.