Git Octo Cat

Git Branchs Management

Git is powerful tool that con help to manage code. But sometimes we don’t know or we are scared about the features aren’t know. At least is our code and don’t want to loose any line of them.

Branch are powerful feature of git. If like we copy all code to new directory and begin work there. But the main difference is that git knows how to join or merge this two directories without broke or loose any line of code and all in same directory 😉

Then, we want to show how manage branchs and easiest that is.

First of all we need to make a dir and init a new repository:

Now it’s time to create some code:

It’s time to see branchs and create new ones:

Now we have two branches. Made some changes to hello.php, and test what happened:

Time to see differences:

We are in master and time to merge branches, now we say: merge second into master:

Merge two branch we don’t need second branch, time to remove:

This kind of work with git give us the opportunity of work in different code branch with different features, it’s like work in different directories without worry about mix code later.


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *