If I have done some local changes to Abc.java and then I go for 'Update to Head' for the same file, it does not undo the changes. Why?
I suppose you're using SVN. If so, then that's what it's supposed to do. update will try to merge the changes from the repo to your working copy, so that you may then test your changes with the latest version from the repo, and commit them once you have verified everything is OK.
If you want to undo local changes, you need to do a revert.
Read the SVN book, it's very well written and explains everything clearly: http://svnbook.red-bean.com/
Related
I just pulled some changes from a remote repository holding my teams project.
This is the message I received on pull:
Apparently, one of my partners made changed to the same file as me.
How do I proceed from here? The message is very vague. Was there an error? Do I have to undo what I did? Does he have to?
I faced this issue today and below solution works for me.
Do a git stash. This will consolidate all your local and conflicting changes.
Do a git pull now
Do you have uncommitted changes in the file that's in your working copy? Or is your working copy clean? The EGit documentation guides you thru the latter scenario.
In my experience, the error dialog posted by #lmray is what EGit shows when a local working copy has uncommitted changes. EGit wishes to merge in information from the remote but I'm told it will not modify a dirty working copy. To proceed, you must first commit your changes locally, giving you a fallback point, then request merge again. The merge should then produce a merged file, hopefully without any conflicts.
Thanks to #B. Dalton for trying to straighten me out - my dirty working copy file had uncommitted changes, and a local git wizard explained things.
Digression: this is a mental adjustment if you (like me) were used to working with SVN, which would happily pull remote changes into a dirty local working file. Not saying that was better, just that git works differently. I'm still struggling to convert my SVN-trained intuition over to suitable expectations for Git.
You must manually resolve the conflict by incorporating your partner's change into your code and committing the manually merged file.
Alternatively, if your changes aren't too complex, you may revert (throw away) your changes to that file, update your code to pick up your partner's changes, and then redo your work.
See http://wiki.eclipse.org/EGit/User_Guide#Manual_conflict_resolution
In Eclipse :-
Right click -> click on 'add to index'
Add conflict file in staged area
Right Click ->click on commit
Add conflict file in local repository
Pull
You will get all changes (change in remote repository and local repository)
Changes mentioned as Head(<<<<<< HEAD) is your change, Changes mentioned in branch(>>>>>>> branch) is other person change, you can update file accordingly.
Right click ->click on add to index
Right click -> commit and push
I use SVN as check-in tool and have installed Subclipse plugin in my eclipse.
I have done some changes in trunk. I have to merge my changes(from trunk) to some branch.
I have never done merging of code. I have searched it on google and found little confusing.Can someone please let me know the steps to follow.
Did you install the merge plugin from the Subclipse web site?
The general process is that you want your working copy to contain the branch you want to merge into. So if you want to merge from trunk to a branch, you should have your branch checked out.
You should do Team > Update so that your working copy is at the latest HEAD revision for your branch. This will make merge faster and run better.
Then do Team > Merge. The wizard presents some options depending on whether you want to merge all changes from trunk that are not already in the branch or whether you want to select a specific revision(s). Normally you want to do the former when possible.
You have to enter the path you want to merge from, so something like /trunk or /ProjectA/trunk or possibly something like /trunk/some.company.projecta etc.
Just make sure the "relative path" matches what you have checked out.
Then just click OK.
Merge is like an intelligent editor for your working copy. When it is done you have changes in your working copy and those still have to be committed. Be sure to commit the entire working copy so that the SVN merge tracking information is all committed with the changes.
I'm cloning a remote repository and want to checkout several branches to interoperate with them (without applying changes to the working directory).
So I clone the repository:
CloneCommand clone = Git.cloneRepository();
clone.setURI(project.getUrl());
clone.setDirectory(new File(RepositoryHandlerHelper
.getFilePath(project)));
clone.setCredentialsProvider(getCredentials());
clone.setCloneAllBranches(true);
clone.call();
And that works. Now I create the remote branches on my local harddrive (in a loop):
git.branchCreate().setName(currentBranchToBuild)
.setUpstreamMode(SetupUpstreamMode.TRACK)
.call();
Which works as well. I'm not sure this is necessary though.. After that I try to checkout each branch:
git.checkout().setName(currentBranchToBuild).call();
I'm sure right branch name is submitted to setName(). No Exception is thrown but the command does not seem to take any effect on my working directory.
Am I missing something here?
I guess you need to add setStartPoint("origin/branchtotrack"), also see my answer to a similar question.
Found a working solution: I don't need to create a local copy of each branch. If I just do a checkout of the remote branch it works. My problem was something different. I'm generating JavaDoc of each branch (checkout then create JavaDoc). But it seems like the checkout does not take effect immediately. If I put a Thread.sleep(1000) between git.checkout... and my call to generate the JavaDoc, it works just fine.
Thanks for the help.
I am developing a java based eclipse plugin that monitors file activity. I need to find out if a given file is checked into the SVN by the user.
edit
There are two files. Local file and repository. I have to keep track of the local file and make sure the user commits it to the repository every time he saves it locally.
You could make svn do the work for you by running svn status /path/to/my/file from the shell on the path to the file. If it isn't checked in then you will get ? /path/to/my/file back (it begins with a question mark). If it is checked in and unmodified you will get no response from svn status, otherwise the line will begin with the character describing the file's status (eg. A, M, D).
Bear in mind if the file is not within an svn repository svn status will throw a warning svn: warning: '/path/to/my/file' is not a working copy.
[edit] Having seen your clarification, you need to check for all the status flags (added, modified, deleted etc.) and remind your user to commit where appropriate. svn help status contains the (exhaustive) full list.
If you run svn status from within the project without providing a path it gives you the status of all the files in the repository. If it is unmodified this will yield nothing, otherwise any changes will be printed to stdout. You probably want to do this, rather than running through each file to check its status.
If it's anything like the SVN we use at my work, you can't. The only thing there is is "Latest Version" which was the last time it was committed. Are you asking about knowing when a file is added to the repository?
I have a CVS repository in which I have a set of Eclipse Java projects where I need to roll HEAD back to the state it was at a specific time yesterday essentially abandoning all commits happened since said time.
I've tried different things, including using "Replace with another branch or version" which gives the proper sources, but where it appears that CVS now thinks I'm actually working "back in time" instead of in HEAD but with other sources which result in changed files showing up in Team Synchronize etc. Also commits tells me I'm working on a sticky tag and fails.
So, what is the proper way to tell Eclipse 3.5.1 that I need to rollback HEAD to yesterday?
I usually use the following for individual files:
Replace With -> History
Which can be found under the right click menu
Pick the version you want (it also includes eclipse locally saved versions)
Then commit to make it the HEAD
I ended up manually merging the files up in HEAD and very, very carefully checking in the sources. This was no fun.
Unless you have a tag in CVS, you will have to examine each file for this, and choose the version to revert to. (it is due to the way CVS stores changes, they are not file system snapshots like other SCMs).
You did a checkin in CVS with many files and after that you want to undo that?
My solution:
Mark the files (if no good checkin after the bad checkin you can mark all) --> Right click "Compare with" --> With Branch or Version --> Dates --> Add Date --> Take Date where you know the HEAD is ok --> Now you are in the Synchronize view, mark all files --> Replace --> Check in the files again
This will not really undo your CVS checkin (history) but you get with not too many clicks the old state. And you dont have to do it file for file.