Skip to content

Latest commit

 

History

History
80 lines (45 loc) · 1.02 KB

commands.md

File metadata and controls

80 lines (45 loc) · 1.02 KB

Git Commands

  1. Initialization Create a new Git repository:

git init

  1. Configuration Set global username:

git config --global user.name "MansiChava"

Set global email:

git config --global user.email "[email protected]"

  1. File Operations Create a new file:

touch

Remove a file:

rm

Restore a deleted file:

git restore

  1. Staging and Commit Check the status of the repository:

git status

Add a file to the staging area:

git add

Commit changes with a message:

git commit -m "your commit message"

  1. Branching Create a new branch:

git checkout -b <branch_name>

Switch between branches:

git checkout <branch_name>

List all branches:

git branch

  1. Logs View commit history:

git log

View concise commit history:

git log --oneline

  1. Remove from Staging Unstage a file (remove from index but keep in working directory):

git rm --cached

  1. Miscellaneous View all files, including hidden ones:

ls -a

Clear terminal:

clear

View command history:

history