Hi I'm using source tree with github for unity as an inexperienced user and have made a big mess. Basically I was making changes to a game in the master branch in a higher version of unity 2019.3 and decided to then revert back to a older version of unity earlier in the master branch.
I then created a new branch and started making new game changes in unity 2018.4. I have decided that I want to keep with unity 2018.4 but the problem I have now is that my master branch is behind and has different changes and in a totally different version of unity. I went to merge and resolve conflicts using theirs to keep changes for the 2018.4 branch but it has left a huge mess.
All I want to do is possible is to delete/remove all the changes I made in the master branch in unity 2019 and just make the top of the 2018 branch become the master so I can continue with that as the master branch.
Is this possible to do if so how, I hope my explanation made sense.
Sounds like you'll need to use rebase to remove the 2019 commits from master. Then you should be able to just merge into master.
Try this
Rebase master, drop bad commits, merge branch.
Should be run git rebase -i master replace the "bad" commits keyword with drop. You'll likely want to specify how many commits to edit, this can be relative like HEAD^x or a SHA of the last "good" commit. Then fix and merge conflicts and merge the second branch with git merge branchname.
You might want to make a copy of the repo on your machine or github before doing this as you could mess up pretty bad.
Get the latest master, revert your local version to the commit you want to be on the master (latest 2018) (find the commit and right click revert to this revision) and push that.
You have a nice answer just about what you are trying to do in an easier way here :D
Related
The problem that i am facing is that when i merge my branch with the development branch to update my branch it deletes a big part of my work.
The strange thing is that when i try to solve it with Visual Studio to merge it doesn't not show any merge conflicts.
My branch is fairly up to date but the only diffrence is that the Entity frame work of our database is updated and the Entity frame work of your SQLite database is updated.
The are also placed in seprate projects should that should not effect my work.
The previous merge from dev did have some conflicts but all of them i had solved and my app work fine.
I got my work back with a Restoring a Revision in a New Local Branch but the problem still stay there that i have to merge my branch with dev to test the functions.
I couldn't find any solutions to the problem online.
File structure
Instead of merging dev to your branch, try instead to rebase your branch on top of dev (if you can afford to force push it, meaning if you are not several collaborator working on that same branch)
git checkout myBranch
git rebase dev
The rebase method that VonC suggest did not solve the problem.
But by creating a new branch with information of the older feature branch we could solve the problem by letting some other developer merge the dev branch to the new feature branch.
But i still don't know what the real cause is of the problem.
I am quite new with Gitlab and I'm having an issue for merging in Eclipse.
We're working as a team, and we all have development branches that we are trying to merge into a single one. Unfortunately, when I did my merge, I have done a stupid mistake. Instead of merging my development branch to the main one, I have merged the main one into my development branch.
I have reversed the commit/merge on gitlab, but now as I try to merge back my development branch into the main one on Eclipse, it seems like I am 9 commits ahead of this branch (described as the arrows on Eclipse here: ), so the potential merge would basically replace everything by my code, when I should actually have merge conflicts to solve.
I am not quite sure how to merge properly so that I get back these merge conflicts.
Here is a screenshot of my network:
The ['1'] commit in the network on the left branch (my branch) corresponds to the merge from Week6AllIssues to my dev branch (the wrong merge). The last commit on this left branch is me reversing the commit.
Thanks a lot for your help !
If you're not using the remote branch with anyone else, the following series of steps might help.
First, remove the superfluous commits from the local branch. It can be achieved with git reset --hard <the commit before you merged master into your branch> command (see this link on how to do this with Eclipse).
Now make the remote branch match your local branch. You can do this with git push --force command. In Eclipse, this command corresponds to configure push - enable "force update" option.
Now the superfluous commits are gone.
We have a Master branch and a Develop branch for our repo. We are supposed to check-in (commit, push) to our Develop branch and then merge that with our Master branch. Then a build is run for the Master branch. I pushed my changes directly to Master (then tagged it), putting Master multiple commits ahead of Develop and now want to bring Develop in sync with Master. What is the best practice to do this? I use GitExtensions and Visual Studio 2015 (am ok doing the operation in either). Do I 'push' Master into Develop or do a check out of remote branch Master and merge with my local?
I would find it most clear to just check out both branches locally, merge in the changes from your local master to your local develop. Then push your local develop to remote.
The workflow I use works something like this in the scenario you describe:
Switch to Develop branch
Fetch All
Choose last (newest) commit in Master, right click => Rebase current branch on => (commit ID)
If Rebase works successfully you're done. If not, you may need to resolve conflicts or cancel the Rebase and merge from scratch.
The reason for using Rebase is that it maintains a single line of commits thus helping keep everything clear.
For more info on the difference between rebase and merge see:
https://www.atlassian.com/git/tutorials/merging-vs-rebasing
I have a forked a repo on GitHub. I have a master on this fork so that I can branch features separately and do pull requests to the upstream/master per feature. The only time my master changes is when the origin changes, meaning I don't merge my features into my master. I have updated my master from the origin and I now need to merge those changes into one of my feature branches.
The problem I am encountering is that I seem to have about 40 Unstaged files in my master branch. There appears to be 2 to 3 of each file marked: ~Automatic Revision, ~HEAD, or ~HEAD_0.
I am not terribly familiar with Git, though the basic concepts seem to be straight forward. I think most of my issues are me not understanding how sourcetree works.
First, Why would there be Unstaged/Uncommitted changes immediately after checking out my master?
Second, How can I be sure I am merging a complete copy of my master to my feature branch so that I am not unnecessarily altering files that are not part of my feature changes while issuing my pull request from my feature branch back to the upstream/master?
Resolved by deleting and re-cloning master branch.
As of the latest version of Github for Windows (1.0.24), I began having issues merging and syncing repos. I have an enterprise github account.
Here is an example situation, I merge my develop branch into the master, but the commit does not display when viewing the master branch in GFW. Therefore the sync option is not available because GFW believes the code on the local repo and server are in sync.
When I look at the master branch source code, I see the the latest commits from the develop branch that were merged into it are there. GFW does not display any commits EXCEPT when you use the Manage branch option. There you can see the lastest commit is the in the master branch.
Something is out of whack, maybe its me!
Any thoughts?
Yep, I get the exact same thing from time to time - you're not crazy.
I wish they'd fix it though