I'm sure it's a simple thing but just can't seem to work out how to refresh/copy with overwrite to a remote server using GIT, SourceTree and Pipelines.
I have a Production branch and also a Sandbox branch in SourceTree both using Pipelines to deploy to remote servers on AWS. I would like to ‘refresh’ the Sandbox branch from the Production branch and therefore make a complete copy of the Production server on the Sandbox (or at least copy all the code but without the history).
I have tried a few times using SourceTree with merging and rebasing options but am always ending up with a merged result rather than a fresh copy of the Production branch.
I would like to know if the ‘refresh/copy’ of the Production branch would be possible from within SourceTree or do I need to create a new GIT repo in BitBucket and migrate the Production branch into there and rename it Sandbox?
Also, I’m not sure if there are any options/config available in BitBucket to achieve the refresh/complete copy of the branch.
So far I have used the following approach:
This result is a merged branch and not a copy of Production. I also tried deleting the local copy of Sandbox but that did not let me push to remote as it is now misaligned with the ‘HEAD’.
I also tried rebasing but that gave the same error as above when I tried to push the changes to the remote Sandbox.
For the push, I have changed the deployment command in the pipelines.yml to ‘git init’ and have tried removing the git log file as well as all the directories to ensure the full content of the local branch is deployed but this still gave a merged Sandbox/Production result.