Since few days I am working on GIT version system. I have mostly worked on SVN system for windows, and its easy to work with as its providing GUI. Its bit difficult to work with GIT (only for initial level).
Today I would like to share some basic knowledge which can help you to start with Git. Some basic commands like Setup repository, push code, add new files, fetch new changes etc…
git init --bare
git update-server-info # If planning to serve via HTTP
From local machine, add code / initial push
git add *
git commit -m "My initial commit message"
git remote add origin email@example.com:my_project.git
git push -u origin master
Its done! repository is created.
Now project contributor can clone and track remote repository (as we do checkout in SVN)
git clone firstname.lastname@example.org:my_project.git
Adds your new or modified files to the queue to be committed later. Files are not committed yet
Delete file which are not more required in directory
git rm file.php
Commits the files that have been added and creates a new revision with a log.
If you do not add any files, git will not commit anything. You can combine both actions with git
Push your changes to the remote repository.
Update your local copy of a remote branch. This operation never changes any of your own branches and is safe to do without changing your working copy.
Pull is context sensitive, so Git will merge any pulled commits into the branch you are currently working in. pull automatically merges the commits without letting you review them first. If you don’t closely manage your branches you may run into frequent conflicts.