- Git add
- Git status
- Git diff
- Git commit
- Git push
- Git pull
- Github
5 year old explanation:
You and Billy decide to draw a picture together with crayons, but you both want to be able to work on it from home. The teacher makes 2 photocopies of what you have started and you both take a copy home (pulling/checking out). You both add more things to the drawing and when you come back to school tomorrow, the teacher cuts and pastes the bits you added / changed and then photocopies that (merging). If you both colored in the same area, someone has to choose which portion to use (resolving a conflict). And since there are photocopies every time something is changed, you can throw away all the new ones if you don't like what you've done (reverting).
*In shorter words git is a way to track your changes.
-
If you haven't already, you need to install Git and create a Github account.
-
Create a local git repository (repo) To get started you'll open up your terminal and move to where you want to place your project by using the CD (Change Directory)command.
-
To initialize a git repository in the folder, run Git Init command.
-
Add a new file to the folder by using your text editor or running Touch command. Once you makes changes inside the folder, git will notice the changes but will not track them officially yet.
-
Run Git Status command to see what git knows exist inside the new folder. This will show you the files that git is not tracking and changes that haven't been saved.
-
Run Git Add command to tell git to start tracking this file. You can run git status again just to see that the command went through and is now tracking your modified file and has placed the file into the staging area and will say something like "Changes to be committed"
-
This is where you'll create a commit by using "git commit -m" and write out a small message explaining the changes you made. ** DO NOT FORGET TO INCLUDE "-m"
-
After you've finished all your commits, you can use your
git push origin master
command to push your commits to github. -
Now that you have that done, you can get pull origin master to have the most up to date version of the repo.