I'm working on a project using Eclipse with Maven and Bitbucket. Right now I can't do any commit, I mean even if I press the commit button, I can't see it on Bitbucket. Furthermore, next to my project's name I got a symbol with an arrow up and the number 2 next to it.
What does it means? What should I do?
This means your local branch is two commits ahead of the remote one. Git is a distributed version control system. The git commit command only introduces the changes to your local repository. To make them appear in the remote, you have to use git push after committing your changes.
Alternatively, you can use Eclipse as a GUI to perform the same steps. In the context menu that pops up when you right-click the project, there should be a Team option. Clicking it brings up another context menu, which should have a Push option.
Related
What I was trying to do was create a local Java project in Eclipse that is version controlled and push it to GitHub so that my other group members can clone this project and begin their own work. I have followed the steps that my professor has provided and made the local project; however, when I go to push it I get the following error (see image). Is it because I already have a master branch created and if so do I need to delete it first? I am going to provide an image of the dashboard of my GitHub repository in addition to the link to the instructions document my professor provided us if that will help to better grasp my question or my process.
This is an image of the error that I am receiving. This is an image of my GitHub repository dashboard. Here is the link to the instructions that my professor provided.
First clone the repository you've created in any of your drives and create project in that cloned folder and try to push it up! It will work!
Hi i think you didn't pull the code before commit. May be in your team mate someone push their code earlier, so you need to pull their changes to your local there after only you need to push your change.
Please pull from your repo and then try to commit.
Goto your eclipse, open the view in the menu 'Git Repositories'.
Ensure you see your local repository and can see the remote repository as a subfolder. In my version, it's called Remotes, and then I can see the remote project within that.
Look for the green arrow pointing to the left, this is the 'fetch' arrow. Right click and select 'Configure Fetch'.
You should see the URI, ensure that it points to the remote repository.
Look in the ref mappings section of the pop-up. Mine was empty. This will indicate which remote references you want to fetch. Click 'Add'.
Type in the branch name you need to fetch from the remote repository. Mine was 'master' (btw, a dropdown here would be great!!, for now, you have to type it). Continue through the pop-up, eventually clicking 'Finish'.
Click 'Save and Fetch'. This will fetch that remote reference.
Look in the 'Branches' folder of your local repository. You should now see that remote branch in the remote folder. Again, I see 'master'.
Right-Click on the local branch in the 'Local' folder of 'Branches', which is named 'master'. Select 'Merge', and then select the remote branch, which is named 'origin/master'.
Process through the merge.
Commit any changes to your local repository.
Push your changes to the remote repository.
I've found that you can't check in changes using that eclipse TFS plugin that span multiple folders within a project.
The only way I can get around this is to check in the changes from one folder at a time!
Surely this is a bug or a setting in eclipse I've missed. In either case its making checking in code very tedious. Any advice?
Check in multiple folders definitely be supported by TFS eclipse plugin. Test pass on my enviroment through Team Explorer Everywhere without any additional settings.
You can specify which file changes you want to check in. On the
Pending Changes page, select one or more changes in the Excluded Changes section. Choose Include from the shortcut menu. You can also
scope your check-in as you work in other areas of Eclipse:
Way1: In Package Explorer or Project Explorer, select one of the following:
◦One or more of the code projects
◦One or more folders
◦One or more files
After you select the items, open their shortcut menu, and choose Team, Check In Pending Changes.
Way2: In Source Control Explorer, select one or more items with pending changes or one or more folders that contain items with pending changes. (Items with pending changes are indicated by this symbol: √ ). Open the shortcut menu of the selected items, and choose Check In.
More info of it from MSDN: https://msdn.microsoft.com/en-us/library/jj155785(v=vs.120).aspx
Hi Patrick Many thanks for your response. I think I've gotten to the bottom of it. So if you Add a file to your project, rename it and then delete it. And then try to make a checkin. The TFS plugin on Eclipse will fail to submit the changes until you right click on the deleted file and Undo it.
I'm thinking TFS is acting correctly because it should allow the user to submit a deleted file into TFS. However the Eclipse plugin doesn't give the user any feedback as to why the checkin has failed. It just fails silently.
If you've got a lot of files to checkin as part of your checkin then it can easily become confusing as to why the checkin fails.
I have project in github. I have committed a irrelevant code in repo. So due to this my app is not working. So i need to import the project without the last two commits. How is this possible?
I am using eclipse IDE and java language code.
I'm assuming that you committed the last two commits locally. Then you want to do a hard reset to go 2 commits back. You can make a backup branch of the two commits in case you still want them later:
# Make backup branch
git branch backup
# Do a hard reset of the current branch
git reset --hard head~2
You need to grab the repo and reset back 2 commits. The best way to do this is to checkout the repo locally:
git clone https://github.com/user/proj.git
and enter the repo.
git reset --hard HEAD~2
and
git push origin master --fast-forward
The last line only if you want to remove the commits.
Thanks for your answers. I have found the answer in IDE iteslf.
Right click the project -> Team -> Show in History -> (A small window will open, it will have all the commits with the caption) -> Again right click on the commit that you need to import -> Click Checkout
I have a repository at bitbucket and I was pulling a changeset from it to Eclipse using Mercurial plugin. Some of the files in Eclipse were modified, so it causes conflicts.
I just want to give up local file and update it with remotes. So I right click project and choose Team - Synchronize with
But what should I click to select remote file and give up a local?
Just right click on the file and select Revert.. as you want to discard your changes.
However in general, if you care about your changes uncommitted workspace update is not recommended. Instead commit your changes first and then rebase or merge after pulling.
Revert - this removes uncommitted changes. It makes the file contents the same as they are in the latest commit
Update - this moves the working directory towards the newest topological head on the current branch.
Rebase - this moves a committed changeset from where it was originally committed so that it becomes based on the target changeset. If in doubt use merge rather than rebase as rebase is an advanced operation.
The problem with uncommitted workspace update is that if there are conflicts there's no easy way to get back to the previous state. If there are conflicts with merge or rebase and you don't want to resolve them now you can press the Abort button in the Mercurial Merge view and it will go back to how it was before.
In Eclipse I can do
right click on file in Package Explorer
Replace with
Another Changeset
select the latest changeset from Remote repository
As I am doing an application which requires to do all the operations like checkout, checkin, commit, rollback and etc.. Please can any one give command line options for SVN tortoise?
As I understand, you want to implement a Java application that calls Subversion commands. I think there are 3 options you could go with:
(and best one): Use SVNKit as a pure Java implementation of the Subversion API in Java. So you have there Java classes and methods and can do anything you want (if you understand how to use it correctly).
You could use JavaHL which is more difficult to install, but then comparable in usage to SVNKit. However, the implementation differs on different platforms (no Java-only implementation), so depending on your usage scenario, it may not be an option.
You could just start svn commands from Java, but I would not do that.
There is enough information available on the internet how to do the base commands with SVNKit, so just give it a try.
TortoiseSVN is a front end to subversion. See the Version Control with
Subversion book for a list of all the command line commands. Appendix E. Command Line Interface Cross Reference of the TortoiseSVN documentation provides another source for the commands.
You will get enough help from internet about tortoise SVN.
You can create a repository in system folder or in Eclipse.
These steps will install SVN plug-in in Eclipse.
Open Eclipse.
Go to Help Click Install New Software
Click “Add” button
Put “Subclipse 1.2.x (Eclipse 3.2+)” under Name and “http://subclipse.tigris.org/update_1.8.x” under Location:
Click ok
Select subclipse selection option in selection window. Select all
Click next button n/a
In review the items to be installed window. Click next.
Licenses must be reviewed and accepted before the software can be installed. Click I accept radio box. Click finish.
During installation eclipse may ask for the validity of plugin being installed. Click ok
After installation. Restart Eclipse.
Create SVN Repository Location in Eclipse
In the navigator perspective, right click and choose new
Choose SVN > Checkout Projects from SVN
Select the option to create a new repository location.
Fill in the location of the SVN repository (https://link-to-repository) and click next. Project info is loaded.
It may ask username and password or validation of repository site certificates. Click “accept permanently”.
From RAD File menu, choose Import to display the import manager. Choose Checkout Projects from SVN. Click Next
Select Use existing repository location option to enable the Next button.
It will load all projects from repository in “trunk”. Expand trunk menu option
Select all the projects one by one to import in projects in workspace.
Why would you not call svn commands directly from java? I mean can't we open a command prompt using a RunTime instance and passing the svn command to it.Is that a bad idea?If yes, what are the disadvantages?