0

All I am very new to GIT and want to understand the very basic rollback operation. What I want to do is rollback my master repo to a prvious commit and discard any of the changes after that. I have searched a lot but am not able to get a clear understanding of this. So this is what I want

A-->B-->C--->D-->E-->F are my commit versions and master is at (F)

I want to do the roll back to B and in my working files folder, I want to see my file and folder structure just the way as it was at the time of working on "B". This then becomes my new master and I started working from here on going forward. Versions CDEF and can be deleted for all I care.

This is something basic that should be able to dobut all the commands I have tried are not giving me what I want...

Can someone please assist.

1 Answers1

0

to permanently lose all your worktree changes and restore the files to the state of C on the current branch.

git reset --hard C
Gregg
  • 2,444
  • 1
  • 12
  • 21
  • 1
    git reset --hard C changes my working files workspace to the structure I had while working prior to commit C, however my repository on the actual server still shows the latest file & folder structure. How do I change the repository on the server to match what I had before commit level C. I am using visual studio code to manage my local working files and have GIT configured to get files from my server via SSH where the actual repositry is. I do not see an option to push this working files copy to the server after I do "git reset --hard C" – user6409836 Jun 02 '16 at 02:00
  • git is a peer to peer architecture. You can go to the server and give it the same command 'git reset --hard C' from within it's repository. Or you can change the branch you are on, and push that new branch to the server. Then transfer your work to the new branch. or try something like 'git push -f ' which force pushes the branch to the remote (if you have permissions). – Gregg Jun 02 '16 at 12:10