Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 1.41 KB

README.md

File metadata and controls

27 lines (22 loc) · 1.41 KB

Git-Cheat Sheet

Git-Cheat Sheet

Creating and Cloning Repositories

git init: Initialize a new Git repository in the current directory.
git clone : Clone a remote repository to your local machine.

Basic Commands

git add : Stage changes to a file for committing.
git commit -m "message": Commit staged changes with a descriptive message.
git status: Show the current status of the repository, including any changes that have been made.
git log: Show a log of all commits in the repository, including the commit message and author.

Branching and Merging

git branch: List all branches in the repository.
git checkout : Switch to a different branch.
git merge : Merge changes from a branch into the current branch.

Working with Remote Repositories

git remote add : Add a remote repository to the repository.
git push : Push committed changes to a remote repository.
git pull : Pull changes from a remote repository to your local repository.

Undoing Changes

git reset: Unstage changes that have been added.
git revert : Revert a commit and create a new commit with the changes undone.
git checkout -- : Discard changes to a file that have not been staged.!