Intellij Idea, Git : Revert commit mechanism not working - java

I am working on managing our project through GIT. I have Intellij Idea and Git running. The git project is running on one of our servers, which are we connecting through ssh.
Currently, everything is working fine except reverting commits. Somehow the reverts are either failing or not changing anything.
For reverting any last commit, I am going in VCS-->Git-->Reset head(Hard), but it is not helping. Before doing that I have pushed commit to master and I am currently(always) working on master. Is that a problem and is that causing revert to not function.
Now, as you can see in the screenshot below, the last commit named Test1234 is responsible for removing a simple System.out and I am trying to revert it commit Test123, which adds a System.out. What am I doing wrong?
Output of git status :
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
The commits in GitGraken :
I don't know which information related to git to post. Kindly let me know if anything is required.

Try right click to the previous commit in IntelliJ and choose reset current branch to here
When I activate this plugin right it works as the previous image

Perhaps try github's commandline, you'd be able to identify the problem. I also had problems, github's commandline is much better and works faster (especially for reverting / deleting commits).
See http://christoph.ruegg.name/blog/git-howto-revert-a-commit-already-pushed-to-a-remote-reposit.html as reference

Related

Arrow up in eclipse git staging

When I try to make a commit and push, an upwards arrow appears next to the project name. This occurs in eclipse and I do not know how to solve it. I have been waiting for some time and it does not seem to go away. The changes that I have make to the project are not reflected in the repository. Help would be appreciated.
From the eGit User Guide:
↑N – The local branch has N commits that are not yet on the
remote-tracking branch. This can be read as "N commits to
push".

how to I revert my solutions to resolve the conflicts?

I have made a few changes, then pulled from git.
I have had merge conflicts after pulling from git.
I have resolved these conflicts, but my app doesn't work as expected.
How can I revert my solutions (undo) conflict resolution?
I'm using 'egit', and 'source tree'
btw, what is a recommended conflict resolver tool?
You can use git merge --abort to abort the whole merge process and take the repo to the state prior to merging.
git reset --hard HEAD~1 will put your code and git repo both back to where they were before the last commit, which is probably the merge commit. Then you can try merging again.
If you don't care about the changes you had, you can always nuke everything local and start with a fresh git clone.

Java Eclipse folder with git

I've been working on a Java package using eclipse and have been using git for version control. I accidentally git rm'd a file, committed and pushed it.
In order to revert the effects, I did a checkout of the deleted files from a previous commit, did another commit and pushed it back. Now I have my files back.
However, those files do not show up in the package in Eclipse -- what could I be doing wrong?
I sometimes get inconsistencies between Eclipse and Git, to solve this I usually just refresh the Eclipse project. I could be more complex than this, but eliminate the simplest solution first.

Eclipse Commiting to SVN

I'm trying to commit my changes to my SVN repo, by clicking on the file, team, commit, but then in the Console in eclipse, it says
commit -m "" /Users/admin/Documents/workspace/Challenge5-Ghostomatic/GhostList.java
Skipped
And it does that for all the files, even though the local version has changes that the SVN doesnt have. How do I fix this?
This "skipped" thing comes from the fact that somewhere, somehow, you corrupted the two trees of files between the repository and your local copy. It is most likely that the issue comes from the fact that you did not merge the two repositories, your local copy, and the subversion copy, before making changes to your file, or adding a file.
Following this tutorial all the way through might help. It's very short and should clear up all your errors.
http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/mylyn.php
If you checked out your project using subclipse or the built in subversion client then it should be a local working copy. You should verify that as kraftan suggested.
If you have somehow corrupted your local copy you can always check out the head revision to a new project area and copy your locally updated files over again. I would suggest backing up your working area before mucking around too much.
What happens if you run a compare with latest from repository?

Can't commit to Subversion from NetBeans

When I change some interface things in Java, like the contents of a menu item, and save them, the commit option does not enable. NetBeans does not know that changes have been produced so I cannot commit them. How can I commit them?
Can you commit from the console?
try svn stat in the root directory of your project, that should show you the files that have been modified with an M near the name of the file. if you can see them, run svn ci to commit all changes.
Maybe (and just maybe), svn is ignoring those files on purpose, to check if this is true, run from the console svn propedit svn:ignore .(<- this dot is necesary) in your project root to check if that directory/file/file extension is being ignored.
Good luck!
Are you using Netbeans 6 or higher? If not, you need to tell Netbeans where the svn executable is (see the link and the associated FAQ).
Are you sure that your subversion repository is running on a machine that is in sync with your workstation's view of the current time (e.g., synch-ed via ntp)? If the time is enough out of sync, it's possible that the subversion module is missing the update and, therefore, not flagging the change.
Also, you should check to make sure that you have an active valid connection to the subversion repository. You can easily do this for the file you just edited: right click on the editor tab for that file and choose Subversion -> Diff or Show Changes or Search History. If any of those fail, your IDE has lost its connection to SVN for some reason.
Another possibility is that you didn't succeed with a real checkout: if the .svn subdirectories aren't properly configured, the menu item will definitely be disabled. I would recommend that you right click on the project (under Projects) and try Show Changes. If that doesn't succeed, you don't have a valid Subversion checkout and the Netbeans options definitely won't work.
If for whatever reason netbeans isn't allowing you to commit, I would suggest either doing it from the commandline, or using a program like TortoiseSVN
It is Subversion's responsibility to know what has changed since the last commit/update. If NetBeans' Subversion interface doesn't allow to commit, then it may be a bug in Netbeans. Technically, there should be no reason to disable commit button - Subversion doesn't prevent you from committing even if nothing has been changed.
Right Click the file which is marked as red color, select resolve confilcts
and try to commit now...

Categories

Resources