Master Git- A Complete A-Z Tutorial From Zero to Hero

From Zero to Hero: Learn A-Z Git in 2 minutes - Complete Tutorial

Explore the A-Z of Git in just 2 minutes. This comprehensive tutorial covers all the essential Git commands and concepts.

Introduction

Are you ready to dive into the world of Git and become a version control pro? In just two minutes, we’ll cover the essential commands and concepts that will set you on the path to mastering Git. Buckle up, because this is your express journey through the A-Z of Git!


Branching

git branchList, create, or delete branches.
git checkout -bCreate a new branch and switch to it.
git mergeJoin two or more development histories together.
git rebaseReapply commits on top of another base tip.
git branch --set-upstream-toSet up a tracking relationship with a remote branch.
git branch --unset-upstreamUnset the upstream information.
git cherry-pickApply changes introduced by some existing commits.


Merging

git mergeJoin two or more development histories together.
git rebaseReapply commits on top of another base tip.


Stashing

git stashStash changes in a dirty working directory.
git stash popApply the latest stash and remove it from the stash list.
git stash listList all stashes.
git stash applyApply a specific stash.
git stash dropDiscard a specific stash.


Remotes

git remoteManage set of tracked repositories.
git remote addAdd a remote repository.
git remote removeRemove a remote repository.
git fetchDownload objects and refs from a remote repository.
git pullFetch from and integrate with another repository or a local branch.
git pushUpdate remote refs.
git clone --mirrorCreate a bare mirror clone of a repository.


Configuration

git configGet and set repository or global options.
git global configSet a global configuration.
git reset configReset a specific configuration key.


Plumbing

git cat-fileProvide content or type and size information for repository objects.
git checkout-indexCopy files from the index to the working directory.
git commit-treeCreate a new commit object.
git diff-treeCompares the content and mode of blobs found via two tree objects.
git for-each-refOutput information on each ref.


Porcelain

git blameShow what revision and author last modified each line of a file.
git bisectUse binary search to find the commit that introduced a bug.
git checkoutSwitch branches or restore working tree files.
git commitRecord changes to the repository.
git diffShow changes between commits, commit and working tree, etc.
git fetchDownload objects and refs from another repository.
git grepPrint lines matching a pattern.
git logShow the commit logs.
git mergeJoin two or more development histories together.
git pushUpdate remote refs.
git rebaseReapply commits on top of another base tip.
git resetReset the current HEAD to a specified state.
git showShow various types of objects.
git tagCreate, list, delete, or verify a tag object.

Alias

git config --global alias.<alias> <command>Create a shortcut for a Git command.


Hook

git config --local core.hooksPath <path>Set the path to the directory where Git hooks are stored.


Experimental

(May not be fully Supported)

git annexManage files with Git, without checking the file contents into Git.
git describeShow the most recent tag that is reachable from a commit.
git format-patchPrepare patches for email submission.
git fsckVerifies the connectivity and validity of the objects in the database.
git helpDisplay help information about Git commands.
git log --mergesDisplay commits with merge information.
git log --pretty=Customize the format of commit logs.
git log --short-commitShow only the first few characters of each commit SHA-1 hash.
git log --statInclude statistics about the changes in each commit.
git log --topo-orderDisplay commits in topological order.
git merge-oursCreate a merge commit where the current branch declares which side of the merge should be considered.
git merge-recursivePerform a recursive three-way merge.
git merge-subtreeCombine the histories of subtrees.
git mergetoolRun a merge conflict resolution tool.
git mktagCreate a tag object.
git patch-idCompute a unique ID for a patch.
git p4Import changes from a Perforce repository.
git pruneRemove objects that are no longer needed.
git pull --rebaseFetch changes and reapply them on top of the current branch.
git push --mirrorMirror all refs to another repository.
git push --tagsPush tags to a remote repository.
git reflogManage reflog information.
git replaceCreate, list, or delete object replace refs.
git reset --hardReset the current branch to a specific commit, discarding changes.
git reset --mixedReset the current branch to a specific commit, keeping changes in the working directory.
git revertCreate a new commit that undoes changes made in a previous commit.
git rmRemove files from the working directory and the index.
git show-branchShow the branches containing a specific commit.
git show-ref --headsDisplay references that are heads (branch tips).
git show-ref --tagsDisplay references that are tags.
git stash saveSave working directory and index in a new stash.
git subtreeMerge subtrees together.
git tag --deleteDelete tags.
git tag --forceReplace an existing tag with a new one.
git tag --signCreate a signed tag.
git tag --verifyVerify the GPG signature of tags.
git unpack-fileCreates a temporary file with the contents of a blob.
git update-indexRegister file contents in the working directory and index.
git verify-packVerify the connectivity and validity of the objects in the database.
git worktreeManage multiple working trees.

Resources to Learn Git Faster ☺️

  1. Git Official Documentation
  2. GitHub Learning Lab
  3. Codecademy Course
  4. Pro Git: by Scott Chacon [Book]
  5. YouTube:

Conclusion:

Congratulations! You’ve just completed a comprehensive crash course in Git commands. Explore and practice these commands regularly to solidify your Git skills. With the right knowledge and resources, you’re well on your way to becoming a Git expert! 🚀

Social Media Share Component
Link copied to clipboard!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top