file1.txt and file2.txt. You run the command git stash push file1.txt. What will be the state of the working directory after this command?The command git stash push file1.txt stashes changes only from file1.txt. This means file1.txt is saved in the stash and reverted in the working directory. Changes in file2.txt remain untouched.
app.js without affecting other files. Which git command achieves this?The correct command is git stash push app.js. The older git stash save is deprecated and does not accept file arguments. git stash alone does not accept file names, and --only is not a valid option.
git stash push file.txt stash all changes instead of just file.txt?git stash push file.txt expecting only file.txt to be stashed. But all modified files were stashed. What is the most likely reason?Specifying files with git stash push is supported only in Git 2.13 and later. Older versions stash all changes regardless of file arguments.
index.html and keep other changes intact?index.html and style.css. You want to stash only index.html changes and keep style.css changes in your working directory. Which sequence of commands achieves this?git stash push index.html stashes changes only from index.html. The other commands either use deprecated syntax or incorrect options.
app.py but want to stash only some of the changes, not the entire file. Which approach is best?The best practice is to stage the parts you want to keep using git add -p, then stash the rest with git stash push --keep-index. This stashes unstaged changes only.