I have 2 local branches that are tracking different repositories:
We have "continous deployment" set up so when I push my local-staging up staging environment will be updated with the changes. I want staging to reflect the code that's on live( which isn't the case currenly).
How might I replace my "local-staging" branch with code from my "local-live" branch? I want to wipe all staging changes making staging reflect what's on live. I want my local-staging to still be tracking the staging repo( ie "git push" from staging will act as expected )
Hope this is clear. Thanks.
When you're publishing a local branch. You can tell Git to track the newly created remote branch simply by using the -u flag with "git push".
Create a new feature branch, say feature, and then switch to that branch. Implement the feature and commit it to our local repository. Push to the feature branch to the remote repository and create a pull request. After other teammate's review, the new change can be merged into the master or release branch.
you want to do a hard reset.
git checkout local-staging
git reset --hard local-live
Seems like you want to merge your live branch into your staging branch.
Here is a detailed guide to do that:
http://www.git-tower.com/learn/git/ebook/command-line/branching-merging/merging
Basically you have to do this:
$ git checkout local-staging
$ git merge local-live
$ git checkout local-live
$ git rebase local-staging
$ git checkout local-staging
$ git merge local-live
Check this:
https://git-scm.com/book/en/v2/Git-Branching-Rebasing
You can do a "hard reset" and a "force push".
$ git checkout local-staging
$ git reset --hard <desired commit of local-live>
$ git push --force origin local-staging
More info:
https://es.atlassian.com/git/tutorials/undoing-changes/git-reset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With