Git Commands Cheat Sheet
The list above is a Git Commands Cheat Sheet, providing an overview of essential Git commands used in version control systems. Git is a distributed version control system that allows developers to track changes in their codebase, collaborate on projects, and manage multiple versions of their code.
The list above is a Git Commands Cheat Sheet, providing an overview of essential Git commands used in version control systems. Git is a distributed version control system that allows developers to track changes in their codebase, collaborate on projects, and manage multiple versions of their code.
Git Commands Cheat Sheet
- git diff: Show file differences that are not yet staged.
- git commit -a -m "commit message": Commit all tracked changes with a message.
- git commit --amend: Modify the last commit.
- git status: Display the state of your working directory.
- git add file_path: Add file(s) to the staging area.
- git checkout -b branch_name: Create and switch to a new branch.
- git checkout branch_name: Switch to an existing branch.
- git checkout : Switch the working directory to a specific commit.
- git push origin branch_name: Push a branch to the remote repository.
- git pull: Fetch and merge changes from the remote repository.
- git fetch: Fetch changes from the remote repository without merging.
- git rebase -i: Rebase interactively to rewrite commit history.
- git rebase branch_name: Rebase the current branch onto another branch.
- git clone <repository_url>: Create a local copy of a remote repository.
- git merge: Merge branches together.
- git log --stat: Show commit logs with statistics.
- git stash: Temporarily save changes for later.
- git stash pop: Apply and remove stashed changes.
- git show commit_id: Show details about a specific commit.
- git reset HEAD~1: Undo the last commit, keeping the changes locally.
- git branch -D branch_name: Forcefully delete a branch.
- git reset: Undo commits by moving the branch reference.
- git revert commit_id: Create a new commit that undoes the changes of a specific commit.
- git cherry-pick commit_id: Apply changes from a specific commit.
- git branch: List all branches.
- git reset --soft HEAD^: Undo the last commit but keep the changes staged.
- git reset --hard: Reset everything to a previous commit, erasing all uncommitted changes.
- git branch --set-upstream-to remote_branch: Set the upstream branch to the specified remote branch.
Comments
Post a Comment