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

middle

Explain the advantages of Forking Workflow

middle

How to revert previous commit in git?

middle

Could you explain the Gitflow workflow?

Bình luận

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

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