Fferanet
Wiki menu

Git

Configuration

Set Global Username and Email

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"bash

Check Configuration

git config --listbash

Basic Commands

Initialize a Repository

git initbash

Clone a Repository

git clone https://github.com/user/repo.gitbash

Add Files to Staging Area

git add filenamebash

Commit Changes

git commit -m "Commit message"bash

Push Changes to Remote Repository

git push origin branch_namebash

Pull Changes from Remote Repository

git pull origin branch_namebash

Branching

Create a New Branch

git branch branch_namebash

Switch to a Branch

git checkout branch_namebash

Create and Switch to a New Branch

git checkout -b branch_namebash

Merge a Branch

git merge branch_namebash

Delete a Branch

git branch -d branch_namebash

Viewing History

Show Commit History

git logbash

Show Commit History with Graph

git log --graph --oneline --allbash

Undoing Changes

Unstage a File

git reset HEAD filenamebash

Revert a Commit

git revert commit_idbash

Reset to a Previous Commit

git reset --hard commit_idbash