0% found this document useful (0 votes)
19 views2 pages

Git Commands Cheat Sheet

This document outlines essential Git commands for setup, staging, updating, and branching. It includes instructions for configuring user information, initializing and cloning repositories, managing snapshots, and integrating changes through branches. Key commands such as 'git init', 'git add', 'git push', and 'git merge' are highlighted for effective version control management.

Uploaded by

Sindhu A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Git Commands Cheat Sheet

This document outlines essential Git commands for setup, staging, updating, and branching. It includes instructions for configuring user information, initializing and cloning repositories, managing snapshots, and integrating changes through branches. Key commands such as 'git init', 'git add', 'git push', and 'git merge' are highlighted for effective version control management.

Uploaded by

Sindhu A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

GIT COMMANDS:

SETUP
Configuring user information used across all local repositories
 git config --global [Link] “[firstname lastname]” – To set a name
 git config --global [Link] “[valid-email]” – To set a email
SETUP & INIT
Configuring user information, initializing and cloning repositories
 git init - initialize an existing directory as a Git repository.
 git clone [url] - retrieve an entire repository from a host via http or ssh.
STAGE & SNAPSHOT
Working with snapshots and the Git staging area
 git status - show modified files in working directory, for the next commit
 git add [file] - add a file
 git reset [file] - unstage a file while retaining the changes in working
directory
 git diff - shows the differences between your working directory and the
staging area (also called the index). Specifically, it highlights the changes
that have been made to your files but have not yet been staged for the next
commit.
UPDATE
 git push - Transmit local branch commits to the remote repository branch
 git pull - fetch and merge any commits from the tracking the changed data
 git rm [file] - delete the file from project and stage the removal for commit
 git stash - Save modified and staged changes
BRANCH & MERGE
Isolating work in branches, changing context, and integrating changes
 git branch - list your branches. a * will appear next to the currently active
branch
 git branch [branch-name] - create a new branch at the current commit
 git checkout - switch to another branch and check it out into your working
directory
 git merge [branch] - merge the specified branch’s history into the current
one
 git log - show all commits in the current branch’s history

You might also like