How can I cancel a Merge in TortoiseGit? - tortoisegit

I must be missing something.
I am a git Newbie. I unintentionally created a Branch when I did a Switch/Checkout on a single file (reverting to a previous version).
I then tried to Merge that right branch. But files were in Conflict, so I cancelled.
Now, everytime I try Commit or Switch I get an error that "did not exit cleanly" but when I try to Commit I get the Conflicted Merge.
How can I cancel the request for the Merge?

You have two choices:
Go to the log dialog and perform a hard reset (on the latest revision of your branch)
Open the context menu in explorer and select "Abort merge" which basically does the same.
Both options will reset all files in the working tree and the index "back" to the latest version of your current branch.
Update: Starting with TortoiseGit 2.4.5 you can also select "git reset --merge" in the "Abort merge" dialog. This option resets the index and tries to restore the pre-merge state of the repository.

Related

How can I get my stashed files back to where it was before stash?

I got a pop-up in my git "The current working tree is not clean. do you want to stash the changes?" It had two options stash and abort i selected "stash" now I don't see my previous changes in my commit list how can I get my changes back? Please answer emergency!!!!!!
Open the context menu in explorer on the repository. Then go to the TortoiseGit submenu and select "Stash Pop".
cf. https://tortoisegit.org/docs/tortoisegit/tgit-dug-stash.html
use below command to get back the stashed files :
git stash pop

xcode source control doesn't show current branch

I'm using the standard xcode source control (version 9.3)
I just reopened my project and when I go to the Source Control Navigator:
It shows a long hex string at the top instead of the current branch name
None of the branches have '(current)' next to them
I have tried cleaning the project and also closing and re-opening.
Source Control->Commit brings up the standard commit interface with the option to leave a comment.
When I click on the very top row (with blue icon) I can see the new commits but they don't show in any of the branches.
What am I doing wrong?
This worked for me:
I clicked on the row with the long hex name. This brought up the version history for the current version.
I right-clicked the most recent change in the change history.
I clicked 'Branch from...' and created a new branch from that point.
For those wondering how something like this could have happened, it is caused when you checkout a commit rather than checkout a branch. Even if you checkout a commit inside the branch that is "current" (even the most recent commit), this will cause the branch to no longer have the "current" written next to it. So when you are sure that this previous commit that you have now checked out is the commit you want to work with, then you must do what Derek posted to do which is to "Branch from..." to make a temporary branch and then merge this temporary branch into the branch that this previous commit originally came from. And then you can delete the temporary branch. It is somewhat of a pain, but a good reason why Xcode does this is so that you are well aware that you are on a previous commit and that you should really make sure this previous commit is what you want your current branch to be at.

How to change default action for "pushing" after committing?

After committing some code locally in TortoiseGit, the window that shows that the operation was successful offers to push the commit (or, in fact, any local commits) to a remote repository. This can be achieved by clicking a button with a dropdown arrow, from where Push, or some other actions can be chosen.
Normally, Push is shown by default, the other actions have to be selected from said dropdown menu.
I am now looking at a repository that was originally imported from SVN (using TortoiseGit). After importing all commits, I have manually reconfigured the remote master to point to a different, true Git repository.
However, after committing, the default action of the aforementioned button is always SVN DCommit for this repository, even after choosing Push several times.
How can I change the default action to Push?
The default of the post action button cannot be changed right now (as of version 2.3.4; see https://tortoisegit.org/issue/2227).
The "DCommit" entry is only shown for Git repositories which have an SVN remote. When you remove the SVN connection the default will be "Push".
Also, with a recent version of TortoiseGit the "OK" button of the commit dialog is a drop down menu where you can select "Commit & push" which should save you a click...

How do I revert back to earlier commit using source tree

I have a project stored on my Mac and created a repository for from that location to my project. I am able to commit using source tree but now I would like to revert back to an earlier commit so all my files in folder update? I'm not sure how i do this?
Temporary Revert Back
If you want to temporarily go back to this commit, then come back to where you are.
Right click on the commit you want to revert to and click on "checkout".
Permanent Revert Back
This will add commits to revert all your work since this commit
Right click on the commit you want to revert to and click on "Reset <> to this commit".
I think in above discussion #dominones and #Giraldi maybe misunderstand each other,
#Giraldi maybe want to delete those unwanted commits permanently in the GIT, and make the git go back to a certain history commit, from there he could start all over again, like you want to be fresh from the beginning of somewhere.
while #dmonones is showing just how to revert back to a status of your code in a history, discarding some code changes you did, which will mostly end up with a new commit aiming to remove a unwanted/mistaken change,
without changing the git history.
To discard an already committed commit in git history, you need to use hard reset and push with force.

AnkhSvn undo/revert a commit

How do I undo/revert a change I've commited, with AnkhSvn/VS 2010.
(I'm well aware you can't "delete" stuff in the subversion repository).
The issue is simple,
You're working on HEAD(e.g. rev 100). You figure out something is broken. You view the history, and figure out rev 93 might be the issue. You want to revert the change done in rev 93, test, and commit those reverted changes.
While I know how to resort to the command line to "undo" this, How do you do this with AnkSvn from within Visual Studio ?
Go to the history viewer (Right-click solution -> View Solution history), here right-click on a revision (or a selection of revisions), and use the items in the context menu to undo your changes.
I use the following process:
With the solution working on the trunk HEAD and with no local files, right click the Solution, go Subversion -> merge
The Merge Wizard will pop up.
On the first page select 'Merge two different trees'
On the second page you want the 'From' to be the HEAD (Latest Version) and 'To' to be the specific revision to roll back to (93 in OP case) and using the 'From' URL.
On the third page, for text and binary conflicts I have 'prompt me for each' selected. I have depth as 'working copy' and leave 'Ignore ancestry' and 'allow unversioned obstructions' unchecked.
On the final Merge Summary page perform a dry-run first, check to see that the changes look correct. Then run the merge.
Finally, commit the changes to the trunk.
AnkhSVN wasn't working when I did Update to a Specific Version, I kept getting an error message about "please update the out of date items and then retry commit". After some trial and error I figured out how to undo a committed file using the command Revert to this revision.
Say for example you are at revision 4440 and you want to make 4435 the new head. Use Revert to this revision to discard all changes after the selected revision.
How to make a prior committed version the new HEAD revision
NOTE: You may want to revert an entire a solution, but keep a couple changes made in the "un-done" revisions. If that's the case before you revert you could: copy out the newer files to a temporary location, do the revert, then copied them back in to revert everything but keep a few changed at the desired state.
Below is how to undo/revert a committed change with both ANKH and Tortoise.
ANKH
With solution open in Visual Studio, Right click context menu (this can be a Solution, Project, or any specific file) > View History > Select revision > context menu > Revert to this Revision.
ToirtoiseSVN
In file explorer right click on the file or folder (this could even be the top folder if you want to do a mass undo): Show Log to display a list of revisions, select a revision, then select Context Menu → Revert to this revision. Then at the top folder level do Commit, and all of the items will be reverted.

Resources