Tuesday 15 April 2014

git - Efficiently dropping current changes already saved -


I'm starting with guit and Magit so I do not know how specific my question is.

Sometimes I save the changes to a file, but then I do not want to commit them: I just want to go back to the last commit.

I am trying to do it with Amax / Magit, whatever I do is just crazy:

  1. I hide the changes (otherwise Maggat has untold / unspecified
  2. I made a committed than the previous one (If I just try the last one macros / maggit then I will leave my changes there Is: does not modify this file)
  3. I'm stash Op
  4. I checkout

    requires lots Kmprassej for it and it is absolutely crazy.

    I am definitely missing something completely clear but I am just not able to do this: That's why I work efficiently forward the drop / last saved changes from Emacs and just Back to last commit?

    I'm not really familiar with Emacs / Magit , but I can tell you the equivalent git commands that you can run from your shell.

    If I understood your question correctly, I believe that you have an easy way to revert all changed files into your existing workspace If it is not, then do not follow these steps. ;)

    • If you want to leave local changes in your work tree for a file without touching any index, you can do this:

        git checkout - & lt; FILE & gt;    
    • If you want to leave all local changes without touching the pointer, you can run it from the root of your repo Git checkout -

    • If you want to leave all the changes in the work tree along with the index, And if you want to move your work tree and index to the state in a checkout, you can use the git reset - hard command ( your work Be aware of any disorganized changes in the tree and countless changes in your index / staging area will also be lost ).

       > git reset - hard head   

      In the above command HEAD is optional BTW.

No comments:

Post a Comment