In darcs, is there a way to recover rolled-back patches? - darcs

In my darcs repo, I needed to rollback to look at a prior change. I made a copy of what I thought was the root directory, rolled back, and deleted.
Now I realize that the root was actually one directory up. So the repo I rolled back was actually my only copy.
Is there a way to access old commits in darcs, as there is in git?

I have not found a way to recover rolled-back patches.
I did find some artifacts that I will now recover the recent changes from.
Note to self: when copying a repository, always use darcs clone, never cp -r. And check to verify where the repository root is.
Could also be helpful if darcs had more recovery features.

If you used the darcs rollback command, then the changes are just undone in the working directory. You can just use darcs revert to undo the rollback (i.e. redo the changes).

Related

Can tortoisegit be configured to automatically merge and it that fails to produce a conflict file to use for merge

We have been using tortoise svn for quite a while and loved it.
When we did an update it would automatically merge and if there were conflicts
it would produce a conflict file and I could use the merge tool on it.
With tortoisegit, if someone has been in the file it does not even attempt to
merge just produces message similar to "Cant". Is this a problem with git or
tortoisegit. We used tortoisegit because of how easy tortoise svn was to use and did not get in the way. Whereas with tortoise git we get the "CANT" and many dialogs to
click on when we do anything.
How can I merge in tortoisegit if there is a conflict, and is there someway to tell
it to produce conflict files.
I will try to summarize how Git synchronization with remote repository works.
You Commit your changes into a local branch.
You want to Push your changes into remote repository. If Git finds out there are new changes in remote tracking branch, it will not allow the Push and will say "you have to do Pull first". (This is a restriction in the Git itself, not only in TortoiseGit.)
As per instructions you do Pull. New merge commit combining yours and others' changes has to be created. If there is no conflict, merge commit is created automatically. If there is a conflict, TortoiseGit force you to resolve it and Commit changes manually.
Finally, you do Push.
I think the main difference from SVN schema is the creation of merge commit, but I don't see this as a disadvantage at all.
A good way to avoid merge commits is to always do Pull before committing so you commit to the newest version of the branch. However if you have working tree changes in a file which needs to be updated during Pull, Git will say Your local changes to the following files would be overwritten by merge and Please commit your changes or stash them before you merge. In this case you should do Stash changes, repeat Pull and finally do Stash Pop.
You may call all these operations from TortoiseGit context menu or you may try to use Git Sync dialog.

How to ignore an incoming commit

I want to have two separate versions of a file: One on github and one on my local machine.
More specifically, how do I ignore a commit coming from the remote server. In this particular case, I modified the file on github, committed it, but I want it to not change on my local machine.
I put the readme file on .gitignore.
Changed the file on github.
Made a commit
Fetched the commit on my local machine using VS2017.
How do I "ignore" the commit. And keep the two versions separate.
You can at least try:
git update-index --skip-worktree -- README.md
As I mentioned here, that would resist a git pull.
And you would keep a local version of README.md, different from the tracked one from GitHub.
I don't presume to know if it is a good idea or not, in your particular situation.

Reverting to a previous version git repo

Hello so I've done this before I just completely forgot how.
What I am trying to do is I have a remote on my github repo and I have an old version that I would like to revert to meaning I can commit from it and it would now be at the top of the repo if that makes sense since my current repo is having some issues and I want to go back to a specific version.
I remeber slightly what I was able to find out last time which worked out beautfully and that was I checked out the version I want and then I created a new remote or split the remote or something, added the version on to the new one and then merged the branches or remotes. It was something along those lines, I just don't remember exaclty and I would appreciate someone guiding me through as I am unable to find the old posts I was previously looking at.
This is a Swift Xcode project
Thank you in advance for all of the help
Instead of rebasing/restting your branch, you could revert the past commits you don't want, in order to create a new commit which would restore the state of the branch to the content of an older commit.
See "Git reset --hard and a remote repository"
git revert HEAD~N
git push
Using terminal git, you can do git rebase -i HEAD~N where N is the number of commits you want to backtrack. Then you can choose to drop or edit commits. In your case, you only need to drop the most recent commits and then you will be effectively back to one of your previous commits. In other cases, this can be used to combine/split commits as well.

How to create an existing Git repository

I've got a repository. When downloading this repo, instead of cloning it, it seems that I accidentally simply downloaded the source instead. Now I've come to commit my changes and noticed that the folder I'm working in is, in fact, not a repository at all but just some random folder.
I've found various ways of initializing a new repo from existing contents. But how can I initialize an existing repo from my existing contents? I added the remote repo as a remote in the GitHub for Windows client, but it doesn't seem to have had the desired effect.
Just to be clear, the intended outcome is as if I had cloned it properly in the first place- history, diffs of the changes I've made from the latest in the repo, the works.
I've tried some solutions involving git clone, like "Clone into a new folder and then just copy and paste the .git folder". However, this seems to have the effect that Git thinks that I deleted and re-added every line of every file in the repository instead of the changes I really made.
From what we talked about in the comments, you should copy over the actual data to the properly cloned repository as opposed to the .git folder. This way, Git has a chance to pick up the changes without introducing any aberrant or unusual state issues.

What's the difference between Commit and Update?

I am new to version control, and am not sure of the differences between using Commit vs Update when using ankhsvn.
What's the difference between a commit and update? When should I use one verses the other?
Commit puts your changes into the repository.
Update gets the latest version from the repository.
Update gets the latest from the repository onto your workspace.
Commit commits or checks in your changes into the repository.
Best practice is to do an Update first to get the latest so that you can merge the changes and resolve any conflicts with the code on your workspace.
You will be forced to do an update if there are changes in the repository when committing but its quicker to do it before trying to commit.
Commit = Commit/confirm your changes to the repository.
Update = Get the latest version/changes from the repository.
When you change a file and want to keep the changes, commit them to the repository.
When you want to get the latest available version/s from the repository, use update to update your local files.
I hope this clear things out for you.
Update is called "Get latest" in TFS/Source Safe if I remember correct...
/Fred
A commit will upload your changed files to the repository and create a revision. Whereas an update will download any revisions from the repository into your local copy.
Commit uploads your changes on the CVS / SVN server, and Update overwrites the files on your localhost with the ones on the server.
This is very very basic SVN stuff. Read the SVN book, or at least the chapter about fundamental concepts and basic usage.
Update means: "take all the new stuff in the repository and apply them in my working copy".
Commit means: "take all the changes I've made in my working copy and apply them in the repository"

Resources