Debug School

Sivakumar S
Sivakumar S

Posted on

git commands

Git command line tool reference:

1.git version = to print version of git
2.git init = to initiate git repository in current work-dir
3.git add = to add specified file to staging area
4.git add . = to add all files in current work-dir to staging area
5.git config user.name = to set up username(author) in config
6.git config user.email = to add email id of the user
7.git commit -m"message" = to commit changes in repo with message(-m)
8.git log = to prints the logs of git operations in repo
9.git log --oneline = to print logs entry in one line format
10.git show = prints commit details of the repo with change details
11.git show = prints detial of the speicied commit with change details
12.git rm = removes file in the work-dir
13.git mv = renames file in workdir
14.git mv = moves specified file to new location
15.git branch = print list of branches in current repo
16.git branch = create new branch with given name
17.git checkout = changes the session to speicified branch or tag of the repo (points the head to specified branch or tag)
18.git remote add origin = adds the remote repo as remote origin for easy transaction
19.git push = pushes (upload) the repo to remote repo mentioned as URL and to specified branch
20.git pull = pulls (download) the repo from remote repo to current repo and merge with specified branch
21.git fetch = pulls (download) the repo and will not merge with current branch, this will be created as remote branch in current repo
22.git switch - = set the session to previous branch (master branch) (moves the head)
23.git reset = rollback mentioned file from staging
24.git revert = to go back to another commit id version
25.git clean -f -d = clears the repo and work dir
26.git merge = unified the master and mentioned branch of repo
27.git cherry-pick = pics the mentioned commit id (cherry pick) from available cherries.

Top comments (0)