Easy question.
I have downloaded gnome-do and I'm starting to learn about it.
By mistake I have removed a file and now I want to update it with the latest version.
What'st the bzr command to do that?
I've tried bzr update but it always says I'm up to date :(
The deleted file looks like an uncommited change. What's the bzr option to rollback that change? I have tried revert, but only removes the previous version of the whole project and didn't recover my deleted file :)
bzr revert <file>
This will bring the file back.
Related
I am trying to figure out how to correctly rename files with git while using Xcode.
I made a test project, with a few commits, then renamed a file in Xcode, verified that the git status did say it was being renamed, and then committed outside of Xcode. This was in accordance with this answer to a SO question (Handling file renames in git).
I go back in to Xcode, try to look into the history of that file before the name change (in the version editor assistant window), and I get the error "This file does not exist in the index." While that is true, the file did not exist at that point, its predecessor did. When I go to the terminal, and run git log --follow myFile.m, I do see all commits, even those before the rename. So with that, the history is there, but Xcode doesn't seem to know how to find it.
How can you follow before a rename of a file in git version control when using Xcode?
PS. It does seem that the blame functionality can see before the name change, but the version editor can not.
I had the same error today and as suggested by matt
the best solution is to use an alternate Git GUI.
I finally solved this by installing the great GitX app by rowanj.
Then i saw the uncommitted change and simply commit it.
TY Xcode for being too git-simple and renaming-painful !
In Xcode we pulled someone else's push and merged with local copy. However now the pulled copy has corrupted storyboard. The worst thing is we accidentally pushed those corrupted file to remote repo. Now is there any way I can solve this issue?
we are using SourceTree as our interface to Git.
One of our member has the last working copy as we haven't pulled any corrupted data from server to his copy.
Any potential solution for this situation? Thanks
Sorry but I'm not enough of a Git expert be be able to give you the exact commands, but there are git commands you can enter to revert a file to a specific revision/commit. If you hunt around the web you should be able to find them and revert the file.
You may have to use command line Git.
This may help Reset or revert a specific file to a specific revision using Git?
and this Rollback file to much earlier version using Git
A pull and merge is commited to the history like any other change so you just need to undo that commit. The git command to delete the last commit and restore your working tree to the previous commit is:
git reset --hard HEAD~1
(from Delete commits from a branch in Git)
This change could then be pushed back up to your server.
In SVN we can update selected file:
svn up index.php
Can we do something like that in Bazaar?
No, you can't update just one file. But you can merge required changes for one file from another (or master) branch:
bzr merge /path/to/branch/index.php
As far as I know this is impossible. Bazaar operates at the repository level. You cannot checkout or update only a directory/file of the repository. Its always the whole thing.
But I could be wrong.
I think something bad might have happened to my changesets.
For the record, I have used git, hg and svn with general success before. My understanding of bzr is less complete.
Here's what I had (Windows XP):
1) A folder created using bzr's svn checkout. Call it stable
2) A folder branched from that which I was using for development. Call it development
My plan was to use commit --local on the development branch to keep track of changes, and it was working swell.
Then, I did a 'bzr update' on (because it complained when I tried to push). At the time, stable had a much older copy of the code. Well, now development has that same old copy. 'bzr log' shows no evidence whatsoever of my local commits!
Can someone explain to me what happened, and what I can do to recover my old code?
Ok, I found it. After some frantic searching, I uncovered the secret code word, "dead head," after viewing this other stackoverflow question:
Some code was lost after doing bzr commit --local, bzr pull, bzr commit
However, the solution they proposed didn't work for me. What did work, was found at
http://chrismarinos.com/don-t-loose-your-head-with-bazaar/
The final answer was to find the revision id using heads --all, and then use pull get get all the revisions:
bzr heads --all
bzr pull --overwrite -r revid:<revision-id>
All my code is back, and now backed up 3 or 4 times.
I honestly cannot say how that would have happened—it honestly looks like that would be the behavior of a (sounds pretty catastrophic bug), unless you did something like bzr pull --overwrite or did a bzr revert after a bzr pull that had conflicts.
First things first, see if you can reliably replicate this problem. Whether or not that is possible, though, file a bug report against bzr so that this issue can be tracked. Also, before doing ANYTHING ELSE AT ALL, back up the data that you have in these branches. If you have been working in a shared repository, back up the whole thing. That way it is available for forensic recovery if such drastic efforts are necessary. For more help on that, though, you'll have to work with the Bazaar developers. It might be helpful to hang out in the #bzr room on FreeNode's IRC network to ask for help. As is the usual for seeking out support on IRC, patience is key even if the situation you're in is pretty urgent. They may be able to give you some Python code or instructions on how to dig up those commits, and they also may be able to tell you how to find out what happened.
That said, what I typically do when doing development like this, is I have an unbound "upstream" branch, and then whatever branch I am working in. When I am finished with my changes, I'll pull from the upstream, merge my branch into the resulting tree, then push back up. For example:
$ bzr init-repo project; cd project
$ bzr branch bzr+ssh://example.org/srv/bzr/project/trunk trunk
$ bzr branch trunk my-feature-branch
$ cd my-feature-branch
... work, commit; work, commit; ...
$ cd ../trunk
$ bzr pull
$ bzr merge ../my-feature-branch
... resolve any merge conflicts here, if any ...
$ bzr ci -m 'Merge in my-feature-branch'
$ bzr push :parent
Doing it that way also keeps your work separate from the upsteam branch until you're ready to merge and push it. And it ensures that your local branch never has the chance to be overwritten.
Is there a way for Bazaar to be able to automatically detect changes (adds, removes, renames, etc.) made to part of the working directory and automatically apply them?
I have a directory tree in my repository which is generated by another process so I can't do all the bzr add, bzr delete, and bzr rename commands as the files are changing. Instead, I would like a way to have bzr notice all the changes and apply them after this process is run.
The only way I can think of doing this right now is running bzr status and then manually (or by writing a script) run bzr add and bzr delete on all the files listed. This will work but I am hoping there is an automated method that could also determine if a file was renamed (an added file has the same contents of a delete file).
You don't need to explicitly mark files as deleted. And bzr can detect renames (either with automv plugin or with builtin functionality):
bzr mv --auto
Note that if you moved the files to a new folder that you just created, you have to version it, but without adding its children (--no-recurse), othervise mv --auto might fail to detect renames:
bzr add --no-recurse newfolder
Then you need to add all files which are not part of renames:
bzr add subdir/
Could you just call bzr add * at the end of the process? Your subsequent commit should take care of all additions and removals. This will not detect if a file was renamed/moved by some process other than bzr mv (and I am unaware of any way to do so).
It looks like the automv plug-in will automatically detect renames and moves. This, along with bzr add * should do the trick.