I’m working on a website and constantly switching from development mode (where the code has every URL in it pointing to localhost, the database is named “project”, the user “root”, empty password, etc.) to production mode (where everything set to work in my hosting, real passwords, real URLs, etc.) and I just recently started to use Git.
Now, I’d like to make a branch that’s for code ready to be uploaded to my hosting, so I don’t have to make a copy and manually change everything every time I want to update my website. So, if I make a change in the code and commit in the master branch, it would be reflected in the code for upload without changing other stuff.
So it would be:
Master -> ReadyForUpload
So my question is, when using Git, is each branch stored in physical storage like a directory with every file in it? Is it possible to export a branch to a directory?
I’m using Git extensions for Windows, by the way.
No. Some other version control systems (eg Subversion) stores branches as subdirectories. In git you have one working area and change which branch you works on within that,
eg.
Nothing seems to change, but you are now working in the ReadyForUpload branch.
if you then do some changes and commit them and you do a
you will be back on the masterbranch and the changes in ReadyForUpload are gone (that is, just stored away)
Of course, if you for some reason prefer to have both branches available at the same time, you can clone your repository to another directory and have the other branch checked out there – using git pull or git push to sync them where applicable.