Git initialization, branching, merging, conflict resolution

//initialize git
git init

//clone or download repository
git clone https://github.com/abcd/abc.git

// pull from remote master
git pull origin master

//create a new branch on local named my_changes_branch
git checkout -b my_changes_branch

//list all the branches with * on current working branch
git branch

//move to master branch
git checkout master

//add the file to push to remote
git add abc.php

//commit and add comments
git commit -m "My first commit"

//push the changes to my_changes_branch or push the branch my_changes_branch
git push origin my_changes_branch

//merge into master

git checkout master
git merge my_changes_branch

Solving conflict

//pull from remote
git pull origin my_changes_branch

Now open the file that has conflict and make the final changes where git has added the comments.

//add the file to push
git add abc.php

//commit and add comments
git commit -m "conflict resolution"

//push the changes to branch
git push origin my_changes_branch

Any suggestions, corrections are welcome.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s