I am working on a project and I am about to do something experimental.
I am not ready to make a commit however.
Is it possible to make a checkpoint that I can revert to? Git stash does not appear to be appropriate in this case as I want to work on the same branch.
Commit is to be performd by user to save data permenntly.. And checkpoint is process, it is occurd when logswitch occurs (means when LGWR switch from one RL File to another) to save data to Datafile permenently. Checkpoint can happen at any time.. Before, after or at the time of commit.
Git has an area called the stash where you can temporarily store a snapshot of your changes without committing them to the repository. It's separate from the working directory, the staging area, or the repository.
Main drawback of committing your changes - whether to a temporary experimental branch or not - is that one loses track of overall extent of work - the combined changes performed up to the checkpoint.
In an IDE, I personally use IntelliJ IDEA, I can see colour blocks in the gutter (near scrollbar) which indicate which lines were edited or added. Deleted blocks of code are indicated by a little clickable triangle, and I can easily see what those deleted lines were by clicking on it.
All this neat IDE stuff works only up to the point you commit your changes.
So, what I would like to suggest is a combination of the above answers - i.e. do commit often and early, potentially edit/rewrite your commit history before pushing/publishing your changes to the remote. Also, after you've committed you perform a soft reset. git reset --soft HEAD^
This way, you will (1) have a commit in your git repo that you can roll back to, if needed. (Use git reflog
to get at the hash of the commit, should you later need to revert back to it.) You also (2) get to keep all changes as un-committed so that your IDE can show you the visual indicators of change.
If you make really bad changes you want to quickly abandon, do a hard reset back to your most recent good checkpoint, then a soft reset to the point where you started making your big changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With