Hello everyone and welcome to the ultimate guild to git. So lets get into it. If you are looking to use a public repo then use bitbucket. So what is Git. Git is a distributed revision control and source code manager. What that means is git can track you entire project, and you can go back and look at source code before you made an error. Git also uses branches. Branches are just like other versions of your code. This is helpful so that you can keep a working copy, but you can hack on the other version to your hearts content. How to get Git. Now that you know how awesome Git is you are probably saying to yourself how do I use this. Well you are going to need to download it from here. Once installed on windows 7 or 8 search for Git Bash in your programs. Open that up because we are going to need it for the next step. How to use it. Git may seem very hard at first but you will get the hag of it soon. First thing that you need to use git is setup. Navigate to your preferred dir. This is where you want git to track your files. So if you had a workspace folder and then your projects in side that. You want to have a git instance for each of your projects that you have. Use the command: cd /path/to/project. Once you get there use the simple command: git init. Congratulations! You have setup git in that folder. If you use git status it should show you all of the files in there. Now we have to add files to git. There are some files that people would not care to have in there public repo online and there is really no need to track some files. That is where a special file comes in handy. It is called the .gitinore. This file you can list files or file types and even folders. Example: Code: # Eclipse stuff .classpath .project .settings/ # netbeans nbproject # maven /*/target/ target/ # gradle .gradle/ # vim .*.sw[a-p] # various other potential build files /*/build/ /buildassets/map_*.txt /*/bin/ /*/dist/ /*/manifest.mf /release # Mac filesystem dust .DS_Store # intellij *.iml *.ipr *.iws .idea/ .checkstyle # Testfiles test.sh If you create this file .gitignore with the example all of those files, file types, or folders will not be tracked by git. Now lets add the files. There are two ways of doing this: "git add <filename>" or you could do: "git add ." Don't forget the period that tells git to track all of the untracked files. Just because the files are added doesn't mean that they are snapshot by git also called commit. Committing is very easy. First lets see if git has started tracking all of our files. Execute the command: git status. If there are a bunch of green files and git says that there is something to commit, then just type: "git commit -m 'Add a commit message here'". You just created a commit. Will be continued... (Coming soon branches and merging) Some basic commands: Code:java git//This is the base command (you will be using this one a lot) Arguments for the command git: Code:java git add //Add file(s) to be tracked by git------------------------------------------git branch //Command to list, add, or delete branchesgit branch <NameOfNewBranch> //Creates a branchgit branch -D <NameOfBranch> //Deletes a branch------------------------------------------git checkout //Command to look at a branchgit checkout <NameOfBranch> //Which branch is the head------------------------------------------git clone //Clones a repogit clone <repo>------------------------------------------git commit //Commits changes to files in gitgit commit -m "Message" //Commits with a message------------------------------------------git diff //Can compare commits, branchesgit diff <branch> <branch> //Compares two branches------------------------------------------git init //Creates a blank repo------------------------------------------git log //Shows the log of commits on the current branch------------------------------------------git merge //Merges two branches together------------------------------------------git push //Pushes the current branch to remote repo------------------------------------------git rebase------------------------------------------git status //Checks if any files aren't being tracked by git[/syntax=java] (Place holder) EDIT by Moderator: merged posts, please use the edit button instead of double posting.
TortoiseGit is also really easy to use, but never used anything else so probably not the best option out there.