Use git stash to save changed files
I want to print the method execute time in KMM, so I added a method named logTime to wrap the method and print the execute time, but I…
I want to print the method execute time in KMM, so I added a method named logTime
to wrap the method and print the execute time, but I don’t want to push the changes to the git repository, I just want to run it locally.
The method that I used is the git stash
, I also specify the stash name, so I can get the information of the changes.
Added stash with specific messagegit stash push -m 'stash name'# My command is like below
git stash push -m 'log_time_v2'
List the stashes$ git stash list
stash@{0}: On develop: log_time_v2
Apply the changes
Because I want to keep the stash after I apply the changes, so I will use the git stash apply
to apply the changes like below:git stash apply stash@{0}
Update the stash
If the method was changed, then the logTime method also need to update, I usually apply the changes, and merge the conflicts, after that create a new stash and drop the old stash.# Drop stash like list
git stash drop stash@{0}