Câu hỏi phỏng vấn Git
Câu hỏi

Can you explain what git r...

Câu trả lời

Git reset is a command used to undo changes and move the repository back to a previous state. It allows you to discard commits, unstage files, and rewrite the commit history. Here's a plain English explanation of what git reset does:

  1. git reset moves the current branch's pointer (usually HEAD) to a specified commit, effectively undoing all commits after that point[1][3].

  2. git reset has three main modes:

    • --soft: Only moves the branch pointer, leaving the index (staging area) and working directory unchanged[2][4]. This is useful for undoing a commit while keeping the changes in the staging area.
    • --mixed (default): Moves the branch pointer, resets the index to match the specified commit, but leaves the working directory unchanged[2][4]. This is the most common usage, as it unstages files but preserves the changes in your working directory.
    • --hard: Moves the branch pointer, resets the index, and overwrit...
senior

senior

Gợi ý câu hỏi phỏng vấn

senior

When would you use git clone --bare over git clone --mirror ?

expert

Do you know how to easily undo a git rebase?

junior

What's the difference between a pull request and a branch ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào