Control Versions
Version control is a system that records changes to files over time, allowing you to manage the evolution of projects efficiently.
-
Verify the status actually in your computer:
git status
-
Compares the changes between different versions of a file and the staging area:
git diff {file}
-
Or compare the working directory with the last commit.
git diff HEAD
-
Displays a log of all commits made to the repository.
git log
-
Displays a more accurate version of the history.
git log --oneline
-
It displays the history as a graph, showing branches and merges.
git log --graph
-
Displays the changes made to a specific commit.
git show {commit}
-
Shows who made each change to a specific line in a file.
git blame {file}
-
Helps to find the exact confirmation where an error was entered.
git bisect
-
Change the active branch to the specified commit and update your working directory with the files of that version. ⚠Be careful!⚠ This command overwrites uncommitted changes.
git checkout {hash}
-
Displays a log of all commits made to the repository, including commits that are no longer referenced by any branch. This can be useful for recovering lost commits.
git reflog