in Technology by
How can we stash only one of multiple changed files on my branch?

1 Answer

0 votes
by
git stash push -p -m "my commit message"

-p let's you select the hunks that should be stashed; whole files can be selected as well.

You'll be prompted with a few actions for each hunk:

   y - stash this hunk
   n - do not stash this hunk
   q - quit; do not stash this hunk or any of the remaining ones
   a - stash this hunk and all later hunks in the file
   d - do not stash this hunk or any of the later hunks in the file
   g - select a hunk to go to
   / - search for a hunk matching the given regex
   j - leave this hunk undecided, see next undecided hunk
   J - leave this hunk undecided, see next hunk
   k - leave this hunk undecided, see previous undecided hunk
   K - leave this hunk undecided, see previous hunk
   s - split the current hunk into smaller hunks
   e - manually edit the current hunk
   ? - print help

Related questions

0 votes
    How to display only the names of the changed files? A. git diff –name-only B. git log C. git status D. None of the options...
asked Dec 17, 2022 in Technology by JackTerrance
0 votes
    How can we create a new branch on both local and remote?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    How will you find out what all files have been changed in a particular Git commit?...
asked Nov 4, 2020 in Technology by JackTerrance
0 votes
    How do you find a list of files that have changed in a particular commit?...
asked Nov 2, 2020 in Technology by JackTerrance
0 votes
    How do you find a list of files that have been changed in a particular commit?...
asked Oct 4, 2020 in Technology by Editorial Staff
0 votes
    How can we create a remote Git branch?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    How can we check out a remote Git branch?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    How can we rename a local Git branch?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    I want to merge two branches that have been separated for a while and wanted to know which files have been modified ... I missed... Select the correct answer from above options...
asked Feb 3, 2022 in Education by JackTerrance
0 votes
    If there are M branch currents, then we can write ___________ number of independent equations. (a) M-2 (b) M-1 ... for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 19, 2021 in Education by JackTerrance
0 votes
    I have this grid: If I change the tables width from 100% to auto, table collapses horizontally. Which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    When you run git fetch from my local repo, will it update your local code and target branch? (1)Yes, the command ... new commits and keep them in a separate branch in local repo...
asked Oct 26, 2020 in Technology by JackTerrance
0 votes
    I have an old, out-of-sync project code in the master branch. Several files have been deleted, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    When you run git fetch from my local repo, will it update your local code and target branch? A. Yes, the command ... new commits and keep them in a separate branch in local repo...
asked Dec 20, 2022 in Education by JackTerrance
0 votes
    After reading the chapter, I know these points: I know that data gets highlighted after being selected. I know ... entry and editing. Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
...