This command sets the author name and email address to be used with your commits
Syntax -
git config -global user.name "name"
git config -gloabal user.email "email"
This command is used to create a new repository
Syntax -
git init [name]
This commant is used to obtain a repository from an existing URL
Syntax -
git clone [url]
This command adds a file to the staging area/Adds one or more files to staging area
Syntax -
git add [file]
This command records or snapshots the file permenently in the version history.
Syntax -
git commit -m "(type in the commit msg)"
This command commits any file you have added with the git add command and also commits any files you have changed since then.
Shows the file differences which are not yet staged
Syntax -
git diff
Lists all files that have to be committed.
Syntax -
git status
This command deletes the files from your working directory and stages the deletion.
Syntax -
git rm[file]
This command is used to list the version history for the current branch.
Syntax -
git log
This command shows the metadata and content changes of the specified commit.
Syntax -
git show [commit]
This command is used to give tags to the specfied commit.
Syntax -
git tag [commitID]
Lists all local branches in current repository.
Syntax -
git branch
This command creates new branch
Syntax -
git branch [branchname]
This command deletes the feature branch
Syntax -
git branch -d[branch name]
Used to switch from one branch to another. It can also create a new branch and then switch to it
Syntax -
git checkout [branchname]
git checkout -b[branch name]
Merges specified branch history into the current branch.
Syntax -
git merge [branch name]
Used to connect local repository to the remote server.
Syntax -
git remote add[var name][Remote server link]
Sends committed changes of master branch/branch commits/pushes all branches to your remote repository.
Syntax -
git push [var name] master
git push [var name] branch
git push -all[var name]
Fetches and merges changes on the remote server to your working directory.
Syntax -
git pull [Respo link]
Syntax -
git stash save - Temporarile stores all modified tracked files
git stash pop - Restores the most recently stashed files.
git stash list - Lists all stashed changesets
git stash drop - Discards the most recently stashed changeset.