I like Git a lot. It is very much powerful then SVN. You can’t commit or merge if there are changes on same branch on server, this will prevent files to overwrite. See following statement.
To create branch, use following statement.
$ git branch branchName
branchName is example in this post, you can give any name. If you run following command, you will see list of branches.$ git branch
Following is list of branches. branchName is that you created and the “master” branch is a default branch that was created for you automatically.$ git branch branchName *master
In above section * show current branch mean you are on master branch. To go on branchName , run following command.$ git checkout branchName
Now make changes any git repository file. You can check changed files that you changed by following command.$ git status
After this statement you will see file name with path where file exists. You must have to commit before switching branch, so that your changes can be save.$ git commit -am 'message'
Message can be any that remind you what changes you commit on any branch. Now checkout to master branch$ git checkout master
Now you will see that your changes aren’t visible there. Merge branchName to master by following command$ git merge branchName
If your changes don’t conflicts, then you are done. If there are conflicts then markers will be left in the problematic files showing the conflicts and you will also see file name with paths in which conflict have in git prompt. You can also use following statement to find difference in branches.$ git diff
Following are marker that will come in the conflicted file.
<<<<<<< HEAD Any statement ======= Changes >>>>>>> branchName
When you resolve conflicts you have to again commit these changes.$ git commit -am 'message'
Now your changes are merged.
More commands will be in next article