Git and GitHub

Git and GitHub

July 22, 2021
Git and GitHub

Important commands

git config

git config --global user.name
git config --global user.email
git init
git add -A
git clone https://github.com/gauravrjoshi/laravel_project.git
git checkout master
git checkout YOUR_BRANCH_NAME
git status
git add .
git status
git commit -m "commit message"
git push origin YOUR_ANOTHER_BRANCH_NAME
git checkout YOUR_BRANCH_NAME
git pull origin YOUR_BRANCH_NAME
git pull origin YOUR_ANOTHER_BRANCH_NAME
git push origin YOUR_BRANCH_NAME
git diff 
git remote add first-push-test https://github.com/gauravrjoshi/first-push-test.git
git remote add origin https://github.com/gauravrjoshi/first-push-test.git
git push origin master 
git mergetool git reflog –all

Git local configuration

git config --local user.email "username@email.com"
git config --local user.name "User Name"
git config --local credential.helper ""

 

Checking Your Settings

git config --list

https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control

You can fetch all branches from all remotes like this:

git fetch --all

Create a branch in Git from another branch

git checkout -b feature/YOUR_BRANCH_NAME main

How to delete a Git branch locally

git branch --delete YOUR_BRANCH_NAME

How to “pull” from a local branch into another one?

You have to tell Git from where to pull, in this case from the current directory/repository (.):

git pull . master

But when working locally, you can simply use merge (pull internally calls merge):

git merge master

 

Leave A Comment

Avada Programmer

Hello! We are a group of skilled developers and programmers.

Hello! We are a group of skilled developers and programmers.

We have experience in working with different platforms, systems, and devices to create products that are compatible and accessible.