Skip to content

Yash-srivastav16/git-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

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.!