May 16, 2015

Useful GIT commands

Install GIT on your PC.
First thing you need to do is customize git environment.

$ git config --global user.name "Dasun"
$ git config --global user.email hmdtharaka@gmail.com
Now it is the time for your first commit...
Create a file called main.cpp. On the same directory do basic commands using Git bash.
$ git status
$ git add main.cpp
$ git commit -m "First commit"
Now I modify main.cpp content and do a commit over same branch. Still this is master.
$ git status
$ git add main.cpp
$ git commit -m "changed in main.cpp"

Now we need to do certain changes in main.cpp but we are not sure about these changes. Hence I create different branch and do my testing there.
$ git branch dev
$ git checkout dev

Suppose, I do several commits on this branch. Now I am confident that my testing was fine. Hence I need to merge these changes with original and I did my change liner. This is what we called fast forwarding. 


Now we need to do certain changes in main.cpp but we are not sure about these changes. Hence I create differen

No comments:

Post a Comment