• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

How do I reverse all the git commands in Eclipse Ide?

 
Ranch Hand
Posts: 730
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Today, I tried to upload my latest work to the git repository using the Team - a place for you to do your git command via terminal.

But, I am poor in my git commands so I ended up doing lots of commands but did not succeeded in uploading my work.  

Instead, now my files - java classes are all mixed up with local and remote pieces.

I can't post a picture here as it is quite blur.

Is there anyway to reverse everything so that it will return my original code ?

I can only think of using a new Eclipse ide and then import my saved copy.



 
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is going to be messy.

Git is designed to allow you to make and archive changes locally and then merge them unto a remote repository. So the first thing you have to sort out is whether the remote repository has any of those loose-cannon changes. If not, then it's just your local system that needs cleaning up.

If you have uncommitted changes that you want to discard, there's a git command to back them out. If they are already committed, you might want to make a git branch off them. Then you should be able pull the good code from the remote, discarding the changes in the mainline branch. At that point you might want to spin off another branch from the clean remote copy, switch to the new branch, and judiciously merge the changes you want from your first branch. Then you should be in good shape to merge from the new branch back into the mainline. It's actually not a bad idea to work on branches rather than directly with the mainline code when you're working in a group anyway.

There's also something called a "git stash" that can be used to temporarily keep things while you're working it all out.

Note that I haven't mentioned any Eclipse options or git shell commands. That's because I'm still not sure exactly what you have.
 
tangara goh
Ranch Hand
Posts: 730
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:This is going to be messy.

Git is designed to allow you to make and archive changes locally and then merge them unto a remote repository. So the first thing you have to sort out is whether the remote repository has any of those loose-cannon changes. If not, then it's just your local system that needs cleaning up.

If you have uncommitted changes that you want to discard, there's a git command to back them out. If they are already committed, you might want to make a git branch off them. Then you should be able pull the good code from the remote, discarding the changes in the mainline branch. At that point you might want to spin off another branch from the clean remote copy, switch to the new branch, and judiciously merge the changes you want from your first branch. Then you should be in good shape to merge from the new branch back into the mainline. It's actually not a bad idea to work on branches rather than directly with the mainline code when you're working in a group anyway.

There's also something called a "git stash" that can be used to temporarily keep things while you're working it all out.

Note that I haven't mentioned any Eclipse options or git shell commands. That's because I'm still not sure exactly what you have.



Er...I actually wanted to sort out all the mess the shortest time but now I think I ended up with a much bigger mess.

So, I actually copied to back-up copy to a new Eclipse IDE.

But, now, even after remove the .git folder, and then after rebuild my maven it is not able to build at all.

All it is giving me is


The requested profile "1" could not activated because it does not exist.



Is there anyway to make Maven build successfully in this case?

I have wasted the whole of yesterday and all these troubleshooting is making me so tired and then I still haven't figure out how to make the "continous testing" using shell script ....

Please advise me if there is a solution on the above.

Tks and belated Merry Christmas.
 
tangara goh
Ranch Hand
Posts: 730
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I managed to get it build successfully after seeing what is the full error.

I think I always get caught up by the situation and then I will waste alot of time not able to make the errors go away.

Am I the only one like that ?

How does other developer always managed to handle this kind of situation, especially in tight deadline ?

Will the management knows and don't care ?

I hope you can still advise me on how to make the shell script how to make the API run in Postman continously without having to manually do a Post and then do another post etc etc.

Really thank you guys for helping me so much all these years.  

 
Tim Holloway
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, your kind of problem used to be just a big an issue for me as it has been for you and in mostly the same ways. A couple of things have helped.

First, any serious project gets a git repository. Local repositories are cheap and easy (just do a "git init ." with no need to integrate into a server repository unless you need to.

Secondly, I run nightly backups. Ideally I've done a git commit at the end of each major bit of work, but just in case I timed things badly, I can pull the project from the nightly backup.

Third, in Eclipse, Eclipse itself keeps a limited change history, and that's often the best place to sort through and discard dead end code attempts.

As I said earlier, it's a good idea to make a git branch when doing new changes to a project. Although I'm very bad about not realizing I should have done that unless I've got a mess on my hands. That's where it's nice if you can stash your changes, back up the to good point, make a branch and merge good changes while discarding bad ones.
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic