Git Init : Git Clone : Git Add : Git Add .: Git Commit - M : Git Commit - Am : Git Commit - Amend
Git Init : Git Clone : Git Add : Git Add .: Git Commit - M : Git Commit - Am : Git Commit - Amend
git commit –amend: Modify the most recent commit, change latest log message
git add -> git commit | forget something | git commit –amend, do forget things,
git add, edit and save the commit msg , git commit --amend --no-edit
git status: Displays the state of the working directory and the staging area
git diff: Show changes to unstaged file
git blame <file>: Shows the commit and author information for each line of a file.
git blame -L <start>,<end> <file>: Shows line-by-line commit and author
information for a specific range of lines in a file.
git reset: Undo local changes to the state of a Git repo
git revert: Forward-moving undo operation that offers a safe method of undoing
changes
• It moves the branch pointer to the specified commit, but it keeps the changes in your working
directory and staging area.
• This mode is useful if you want to undo a commit but keep the changes available for further
modifications or if you want to recommit the changes with some adjustments.
• After using "--soft", you can modify the files and create a new commit.
• On the other hand, "git reset --hard <commit>" moves the branch pointer to the specified
commit and discards any changes in the working directory and staging area.
• This mode is more destructive because it permanently removes the changes made after the
specified commit. Make sure you have a backup of any important changes before using "--
hard".
• "--hard" is useful when you want to completely undo the commits and start fresh from a specific
point in history.
git log: Review and read a history of everything that happens to a repository
git log --graph: Shows a graphical representation of the commit history.
git reflog: Shows a log of all reference updates, including branch checkouts and
commit changes.
git reflog show <ref>: Shows the log of a specific reference, such as a branch or
HEAD.
git reflog delete <ref>: Deletes the reference from the reflog.
git show-ref: Displays references (branches, tags, etc.) in a Git repository.
git show-branch: Displays the relationship between branches and their commits.
git config --global alias.<alias-name> <git-command>: Creates an alias for a
frequently used Git command.
commit.
repository
git push <remote-name> <branch-name>: Upload local git repo to remote
repository