git in the middle of work

Asked 1 years ago, Updated 1 years ago, 35 views

Is there a way to temporarily save something in the middle of a git management development (half done to commit)?

Now I have no choice but to make a commitment with the comment "Middle".

Situations include when you're away from work for a while or when you want to resume work on another PC.

git

2022-09-30 17:51

4 Answers

    Save your work temporarily with
  • patch.
    Add Work

     git add.
    

    Save

    git diff>>patchfile
    

    The rest is

     patch-p1<patchfile
    
  • stashSave your work temporarily
    Add Work

     git add.
    

    Save

     git stash
    

    Add a message

    git stash save 'message'
    

    You can view a list of saved states.

    git stash list
    

    Back to the previous task

    git stash apply
    

Save your work temporarily with patch.
Add Work

 git add.

Save

git diff>>patchfile

The rest is

 patch-p1<patchfile

stash temporarily saves your work
Add Work

 git add.

Save

 git stash

Add a message

git stash save 'message'

You can view a list of saved states.

git stash list

Back to the previous task

git stash apply


2022-09-30 17:51

wip and other commit messages, and if you want to use them on other terminals, push them (to the working branch).

In particular, even if it is completed only locally, I have recently used commit instead of stash.The reason is that if you accidentally drop the stash, basically you can't recover it anymore, but if you commit, you'll still have a reflog and you can recover from it.


2022-09-30 17:51

Qiita article Stop doing this for Git! List "No.3: Don't commit and push for now", why don't you create a branch for that and commit and push it?


2022-09-30 17:51

I found a tool called git-now when I looked into something similar before, so I'm using it.
You can create temporary commits with git now and git now rebase put together temporary commits with rebase-i.

What I'm doing is the same as making a temporary commit, so if you want to push, I think it's better to make a special branch before doing it.


2022-09-30 17:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.