Getting Started With Git
1 minute read
Getting Started with the GIT Version Control System
What is Git?
Installation
Linux
Debian
sudo apt-get install git -y
Redhat
Using the yum package manager
MacOSX
Basic commands
Basic Configuration
git config user.email <youremail@example.com>
git config user.name "Your Name"
[user]
name = Your Name
email = <youremail@example.com>
[core]
editor = vim
pager = less -S
[color]
ui = true
diff = auto
status = auto
grep = auto
interactive = auto
[merge]
tool = vimdiff
[alias]
ci = commit
lg = log --all --abbrev-commit --decorate --graph --oneline
st = status
co = checkout
mt = mergetool
[credential]
helper = cache
[help]
autocorrect = 10
Creating a new repository
mkdir new_repo
cd new_repo
git init .
git remote add origin <git@your-remote-url.com:username/repo_name.git>
Commits
git add . # Add all files in source tree
git commit # Add files to git
git commit -m "Commit Message" # without opening your editor
Commit History
git log --all --abbrev-commit --decorate --graph --oneline
Branching
git checkout -b new_branch # Create and switch to new branch
git checkout master # Go to branch named master
git checkout commithash # Checkout the state of the repository as at the commit
#hash
Tags:
git ,
math ,
programming ,
python ,
science ,
scripting ,
vcs
Categories:
git ,
math ,
programming ,
python ,
science ,
scripting ,
vcs
Updated: January 30, 2020