DevTools Logo

Getting Started with git: A Beginner Guide

Jun 1, 2025NinjaFunction Team
GitGit Commandgit-cmd

Oficial Website: www.git-scm.com

Documentation: https://git-scm.com/doc

Getting Started with git: A Beginner Guide

Introduction

Git is a powerful version control system that helps developers manage codebases, track changes, and collaborate effectively. Below is a table of essential Git commands, followed by a summary of each to help you understand their purpose and usage.

Git Commands

CommandSummarySyntaxExample
configGet and set repository or global options.git config [options] [key] [value]git config --global ninjafunction "Ninja Function"
cloneClone a repository into a new directory.git clone [url] [directory]git clone https://github.com/user/ninjafunction.git
statusShow the working tree status.git status [options]git status
diffShow changes between commits, commit and working tree, etc.git diff [options] [<commit>] -- [<path>...]git diff
commitRecord changes to the repository.git commit [options] [--] <pathspec>...git commit -m "Added new feature to ninjafunction"
notesAdd or inspect object notes.git notes [command] [options]git notes add -m "Note for commit" abc123
restoreRestore working tree files.git restore [options] [--] <pathspec>...git restore --staged file.txt
resetReset current HEAD to the specified state.git reset [options] [<tree-ish>]git reset HEAD~1
rmRemove files from the working tree and from the index.git rm [options] [--] <filepattern>...git rm file.txt
mvMove or rename a file, a directory, or a symlink.git mv <source> <destination>git mv file1.txt file2.txt
branchList, create, or delete branches.git branch [options] [<branchname>]git branch feature/new-feature
checkoutSwitch branches or restore working tree files.git checkout [options] <branch>git checkout feature/new-feature
switchSwitch branches.git switch [options] <branch>git switch feature/new-feature
mergeJoin two or more development histories together.git merge [options] [<commit>...]git merge feature/new-feature
mergetoolRun merge conflict resolution tools to resolve merge conflicts.git mergetool [options] [<file>...]git mergetool
logShow commit logs.git log [options] [<revision-range>] [[--] <path>...]git log --oneline
stashStash the changes in a dirty working directory away.git stash [command] [options]git stash save "WIP"