What command is used to move a file from modified to staged in Git?

Prepare for the Cisco Certified DevNet Associate Exam. Use flashcards and multiple choice questions to boost your knowledge, with hints and explanations to guide you. Ace your exam effectively!

In Git, the command used to move a file from the modified state to the staged state is "git add." This command tells Git that you want to include changes made to a file in the next commit. When you modify a file in your working directory, it's in the modified state, meaning the changes are not yet tracked for the next commit. By using "git add," you are explicitly indicating that these changes should be prepared for the commit process.

When you execute "git add [file]," the file is now considered staged, meaning it's ready to be included in your next commit operation. This is a crucial step in Git's workflow, as it allows you to control what changes will be included in your version history. The staging area acts as a buffer between the working directory and the repository, allowing for more careful management of what changes are committed.

Other commands listed, like "git stage," "git move," and "git commit," do not perform this specific function. "git commit" is used to save the staged changes to the repository, while "git move" doesn't exist as a command for staging files in Git. Hence, "git add" is the appropriate command for moving files from modified to staged.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy