Git is the free and open-source distributed version control system that's responsible for everything GitHub related that happens locally on your computer. This cheat sheet features the most important and commonly used Git commands for easy reference. This cheat sheet features the most important and commonly used Git commands for easy reference.
INSTALLATION AND GUI'S:
1. Github for Windows
https://windows.github.com2. Github for Mac
https://mac.github.com
3. Git for All Platforms
http://git-scm.com
4. For Linux and Solaris platforms, the latest release is available on the official Git website.
GIT-SETUP :
Configuring user information used across all local repositories.
1. set a name that is identifiable for credit when reviewing version history
$git config --global user.name "github username or valid-email"
2.set an email address that will be associated with each history marker
$git config --global user.email "valid-email"
3.set automatic command line coloring for Git for easy reviewing
$ git config --global color.ui auto
SETUP & INIT
Configuring user information, initializing, and cloning repositories.
1. Initialize an existing directory as a Git repository
$git init
2. Retrieve an entire repository from a hosted location via URL.
$git clone "repository URL"
STAGE & SNAPSHOT:
Working with snapshots and the Git staging area:
1. Show modified files in the working directory, staged for your next commit.
$git status
2. add a file as it looks now to your next commit (stage).
$git add .
3. Unstaged a file while retaining the changes in the working directory.
$git reset [file]
4. Diff of what is changed but not staged.
$git diff
5. Diff of what is staged but not yet committed.
$git diff --staged
6. commit your staged content as a new commit snapshot
$git commit -m "descriptive message"
BRANCH & MERGE:
Isolating work in branches changes the context and integrating changes.
1. List your branches. a * will appear next to the currently active branch
$git branch
2. Create a new branch at the current commit
$git branch [branch-name]
3. Switch to another branch and check it out in your working directory
$git checkout
4. Merge the specified branch’s history into the current one
$git merge [branch]
5. Show all commits in the current branch’s history
$git log
Let's know more about Git:
Git is a version control system.
It can be used with various tools or locally on your computer to help you keep track of changes in your code projects.
Think of it like Google Docs for code, but better.
Log changes in a searchable way, instead of renaming a file for each version.
Collaborators can work in parallel and merge their changes automatically, instead of manually comparing the differences between a file.
Github Key-Terminology:
fork: your own copy of someone else's repository.
stage: add to a cohesive group/bundle of revisions
*******Thank you all for reading!********
0 Comments