Web Content Display
Every time you commit your changes, Git will keep track of every version you have committed before. Versions will be managed separately on your device and the cloud.
As far as you modify and commit your source files without pushing, Git will save it as a new version on your local storage. Once you push, all your versions will be uploaded to Git, taking the newest one as the good one.
While working on our repository we also have the option to check all the previous versions of our work by clicking on the commits tab.
Once you are on the commits page, you can see all the versions that the project has had. In addition, you can also track the states of the branches and to which branch belong every commit.
Once we have selected a version, we can either replace the newest one with this one or copy some interesting parts that we have lost since Bitbucket gives us an online code viewer on its website. To check older versions of a file we need to go to the commits tab by clicking on the left sidebar respective button.
Bitbucket also gives us the opportunity of working on the same project but with different versions. We can branch our project into different paths to keep a version clean and experiment on the other or for working separately on different aspects.
Recover old version commits
In order to recover any older version from a project, we should first check the desired commit id. It can be found on the commits tab next to the commit that we want to recover. It should look like this: [6a92507].
Once we have checked our commit ID the only thing left is to run these commands.
$ sudo git reset --hard commitID;
$ git push origin branchName --force;
Manage remote repositories
Remote repositories can be managed using the remote command.
For example, we could imitate git clone but track only selected branches by using these commands.
$ mkdir project.git
$ cd project.git
$ git init
$ git remote add -f -t master -m master origin git://example.com/git.git/
$ git merge origin