I am new to git & mercurial and experimenting with these tools. I use perforce as source control at work so end up comparing the functionality with it.
Right now, I have a repository which looks something like below:
Repo_1:
DummyProject:
Master/Default - branch
Release - branch
AnotherBranch - branch
For Git/Mercurial, I am using Atlassian's SourceTree GUI client for operation. I have cloned this full repository locally and can see the branches in the GUI client. To switch between branches, I can checkout using this tool.
Let us say I am working in Master/Default branch and did some changes to some of the files. While I am still working on this branch some critical issue shows up and I need to make a change in the Release branch. At this point, if I switch to release branch from Master/Default branch, the SourceTree basically updates the working directory with the content of release branch. It gives me warning that I have some unsaved changes and I should either commit or shelve/stash these changes before switching to release branch.
In perforce, I would normally have 3 folders with name of the branches and I can fetch the latest from release branch and make changes on release branch without worrying of master/default branch being overwritten because both branches are in different directories. And once I am done, I can submit the changes in release branch and resume working in master/default branch.
Is there something I can do in either git/mercurial?
The closest option I could think of to do something like this is to clone the repository again (maybe from local one instead of remote to save network overhead) and then work on release branch and push the changes back to local and remote repository.
I am thinking that would be probably waste of local space because the repository would have to clone all the history and metadata again for this purpose.