Published

GIT Tips/Tricks

Authors
  • avatar
    Name
    xNoJustice

Github Config Settings

Set Name git config --global user.name "user.name"

Set Email git config --global user.mail "user.email"

Console Commands

List All Files in Folder ls

Go to the Folder cd <folder_name>

Create File touch <file_name>

Create File and Open with Visual Code code <file_name>

Delete File/Folder Name git rm -r <file_name>/<folder_name>

Github Commands

Create a New Local Repository git init

Create a Working Copy Of a Remote Repository git clone <link>

Add One or More Files To Staging git add <file_name> / git add . (For All)

List Git Status git status

Commit Changes to Head git commit -m "Commit Message"

Connect Remote Repository (If You Use Local Repository) git remote add origin <link>

Create New Branch git checkout -b <branch_name>

Switch From One Branch to Another git checkout <branch_name>

List All Branches git branch

Delete Branch git branch -d <branch_name>

Push All Branches to Your Remote Repository git push --all origin

Push All Changes to Your Remote Repository git push origin <branch_name> / git push

Delete a Branch On Your Remote Repository git push origin :<branch_name>

Fetch And Merge Changes On The Remote Server to Your Working Directory git pull

To Merge a Different Branch Into Your Active Branch git merge <branch_name>

View All The Merge Conflicts git diff

View The Conflicts Against The Base File git diff --base <file_name>

Preview Changes, Before Merging git diff <first_branch> <second_branch>

Assigning a Tag to a Commit git tag 1.0.0 <commit_id>

Push All Tags to Remote Repository git push --tags origin

Undoing Local Changes (New Files Are Not Deleted) git checkout -- <file_name>

Undo All Changes in Local git fetch origin / git reset --hard origin/master