Learning git
Git Command Helper
- git —version
- To Check git installed with what version.
- git config —global user.name "Prakash"
- To identify committer name, we can set using this command.
- git config —global user.email "prakash@test.com"
- To identify committer email, we can set using this command.
- git config —global user.email
- To get who using this git setup, there email id.
- git config —global —edit
- Edit email and name using editor.
- git init
- To make empty repository.
- ls -a
- To see .git file or hidden file
- git status
- To check which all new file added or removed and which all file in commit or staged area.
Staging Area : cache area or before committing area.
- git add filename.java
- To add file to staging area
- git commit -m “message”
- To move code to committing area, from staging area.
- git log
- Log of all commit and each commit will have unique hash identifier.
- It also tell who committed when and what file
- It also tell committed root or current head
-
O/P:
- commit 0773566c516cc82baafcdd33f3a8cf350a696d68 (HEAD -> master)
- Author: Prakash prakash@test.com
- Date: Sun Oct 2 12:07:22 2021
initial commit
- Fish tool. * Help in autosuggestion for git command.
- git checkout hashcode/master/branch
- Help in switch between committees.
- Switch between branches
- git branch
- To see all branches
- To see current working branch
- git branch branchName
- To create new branch
- git checkout -b branchName * Checkout with creating new branch
- git merge prakash/multiply * merger updated prakash/multiply to current dev branch
- touch .gitignore
- Help hiding file from git ecosystem and will not show in git status.
- Just add file name in this file
- To see hidden folder in Mac : Command + Shift + .
- git remove add origin remote_repository_name
- To connect with remote GitHub repository
- it remote -v
- To view remote repository name
- git clone github_remote_repository_name
- To clone or download repository on your device.