Git is a sophisticated, distributed version control system that can handle both small and large projects efficiently and easily. It is open-source and free. Git can be used to monitor changes in files and coordinate work among developers. It aims to promote data integrity, support for a disseminated, non-linear workflow, and speed.
What is Git?
Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. It has an intuitive design which makes it easy for first-timers, but still offers advanced features that are useful for experts. Git’s development began in 2005. The project was created out of frustration with the limitations of existing tools (such as CVS).
In addition, Junio Hamano wanted to create a new product without having any formal software engineering experience. Git quickly became popular within Linux distributions because Linus Torvalds pushed its adoption there. As more companies started using it even outside the Linux world, various other products were built on top of or alongside git such as GitHub and Bitbucket.
Git Cheat Sheet
This is a simple Git cheat sheet. Most usage Git command lines are included.
Basic workflow
git init
create new repository
git clone /path/to/repository
clone local repository
git clone usernam@host:/path/to/repository
clone remote repository
git add <filename>
add changes of a file
git add *
add all changes
git rm <filename>
delete a file
git commit -m *<comment>*
commit changes
git push origin naster
push changes to remote repository
git remote add origin <server>
connect local repository to remote one
git pull
update local repository with remote one
Branches
git branch
List all local branches
git branch -a
List remote and local branches
git checkout -b <branch_name>
Create a new local branch and switch to it
git checkout <branch_name>
Switch to a branch
git push origin <branch_name>
Push a branch to remote
git branch -m <new_brand_name>
Rename a branch
git branch -d <branch_name>
Delete a local branch
git push origin <branch_name>
Delete a remote branch
Clean up
git clean -f
Delete all untracked files
git clean -df
Delete all untracked files and directories
git checkout -- .
Undo local modifications to all files
git reset HEAD <filename>
Unstage a file
Stash
git stash save "<stash_name>" && git stash
Save changes to a stash
git stash list
List all available stashes
git stash pop
Delete a stash from the list
Log
git log --oneline
Show commit history in single lines
git log -10
Show commit history for last 10 commits
git log -p -10
Show commit history for last 10 commits with diff
git diff
Show all local file changes in the working tree
git diff <filename>
Show changes made to a file
git blame <filename>
Show who modified a file
git remote show origin
Show remote branches and their mapping to local
Git Tutorials and Courses
The Definitive, Step-by-Step Guide to Git – This course is ideal for programmers, software engineers, developers new to the system, creative professionals, freelancers, or anyone who wants to use Git. You will learn Git’s key concepts and entire workflow, compare various states in the system, and fork and create repositories on GitHub. The course will also teach you how to manage files using Git, resolve merge issues, create branches, and make comparisons between commits and branches. The course includes screencasts, audio/video presentations, and document lectures.
How Git Works – How Git Works is perfect for system administrators and developers who want to know more about Git. You can take advantage of the free 10-day trial to see if the course works for you. One of the best things about the course is that it offers guided learning. You can measure your progress towards your learning or business goals. You can also apply and practice your knowledge in real-world situations with the help of this course.
Pro Git book – Ben Straub and Scott Chacon wrote the book. You can get it for free, and it covers various topics including the history of Git and how to install and set up Git, get a Git repository, record alterations to the repository, work with remotes, manage branches, and more.
Learn Git (Interactive Tutorial) – In this course, you will learn Git’s workflow and core features, how to do collaborations with pushing, remotes, and pulling as well as how to save different versions of your project and undo changes.
How to Use Git and GitHub – In this course, you will learn how to use Git, commit changes, build a new Git repository, review an existing repo’s commit history, and keep commits organized using branches and tags. You will also learn how to revert changes as well as delete and edit commits.
Git Clients
Git GUI – Git comes with built-in GUI tools for committing and browsing.
TortoiseGit – TortoiseGit is a Windows Shell Interface to Git and is based on TortoiseSVN. It’s open source and can fully be built with freely available software. It provides overlay icons showing the file status, a powerful context menu for Git, and much more!
SmartGit – The tool is a graphical Git client with support for SVN and Pull Requests for GitHub and Bitbucket. SmartGit runs on Windows, macOS, and Linux.
GitKraken – GitKraken is a Git GUI client for Windows, Mac, and Linux to help Git users to keep track of their repositories, see branches, and tags, create new, all the history of our work, commits, and so on.
By continuing to use the site, you agree to the use of cookies. more information
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.