Git Product home page Git Product logo

Comments (7)

shawjef3 avatar shawjef3 commented on August 12, 2024 4

Reversing/reverting hunks and selected lines are the only features keeping me from switching from SourceTree.

from sublime_merge.

srbs avatar srbs commented on August 12, 2024 4

This has been added in dev build 2024!

from sublime_merge.

hstormo avatar hstormo commented on August 12, 2024 2

Here's a way to at least check out files:

[
    { "caption": "-" },
    {
        "caption": "Reset file to this version",
        "command": "git",
        "args": {"argv": ["checkout", "$commit", "$path"]}
    }
]

Save in your user folder as File.sublime-menu.

from sublime_merge.

kakra avatar kakra commented on August 12, 2024 2

Isn't this usually a problem of having committed unrelated changes within the same commit previously? If a hunk could work on it's own it should have been committed as a single commit in the first place... While it may come in handy, it may promote not committing atomic changes.

If you need to revert a hunk, you should probably revert the complete commit without yet committing it, then only stage the hunks that need to be reverted, commit, then discard the rest.

So I think it could be useful to have a context menu item "Revert without committing" aka git revert --no-commit. That way, you could either squash multiple reverts into one, or stage just one reverting hunk and discard the rest.

from sublime_merge.

deathaxe avatar deathaxe commented on August 12, 2024 2

Isn't this usually a problem of having committed unrelated changes within the same commit previously?

No. What if you made a fix for an issue which containes many code lines. During review another guy finds a regression in maybe one or two lines, which he wants to revert.

This might not be an everyday scenario, but I was sometimes faced to it here and there.

If you need to revert a hunk, you should probably revert the complete commit without yet committing it, then only stage the hunks that need to be reverted, commit, then discard the rest.

  1. Of course, you can always take the long way - or the sublime one.
  2. This PR was made with the functionality of GitExtensions in mind and to make all git related functions (stash,stage,revert) work the same way on all pieces of code.

from sublime_merge.

srbs avatar srbs commented on August 12, 2024

Workaround for reverse hunk:
https://forum.sublimetext.com/t/reverse-hunk-workaround/44645

from sublime_merge.

deathaxe avatar deathaxe commented on August 12, 2024

Nice job.

from sublime_merge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.