frobak
frobak

Reputation: 567

How do GIT branches work?

I have a query about GIT branches, and the documentation doesn't seem to cover it.

The scenario:

I have an application.
I want to make some edits, so I create a branch on my repository.
I make commits on the branch.

Now, how do I view these edits in a live environment, without committing them to the master live application.

I obviously need to check the edits in a live environment before committing to the main application?

Am i missing something?

Upvotes: 0

Views: 149

Answers (3)

Vorsprung
Vorsprung

Reputation: 34297

Ok here is the literal answer to your question

On the live server alter the branch to the new branch you've made and pull the changes

Check it works on the live system

If it is broken, simply revert to the master branch by checking this out again

This is an incredibly stupid idea but - under completely different circumstances - companies like netflicks do do something a bit like this. Look up "Blue-Green Deploys". They mitigate the problems of broken stuff in live by having many many duplicated failover load balanced copies of their live environment

I'd just like to reemphasis that "trying out stuff" on your live server is dumb

Upvotes: 0

Andrey Deineko
Andrey Deineko

Reputation: 52347

  1. Set up staging environment;

  2. Push the new branch to staging;

  3. See how it goes;

  4. Work further or merge/rebase with master and go live.

The issue itself has nothing to do with git branching.

As to

Worrying thing is that Google doesnt really give much searching for "git staging environment"

Your search keywords are: php mysql staging environment

Upvotes: 2

wpercy
wpercy

Reputation: 10090

You need to create some sort of staging environment, maybe on your local machine, maybe on a server in the cloud - it all depends on what kind of environment your "live" environment is. Then you can push your changes to that environment and see how it affects your product before merging your changes back into your master branch.

Upvotes: 6

Related Questions