Skip to content

mrafiq709/Git_Command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 

Repository files navigation

Git_Command

Essential git Command

#For adding Remote:

git remote add origin <remote_repo>

#Git igone permission:

git config core.fileMode false

#For adding all Files:

git add .

#For Commit:

git commit -m "Initial Commit"

#If Remote is already exist:

git remote set-url origin <remote_repo>
git remote -v

#Remove untracked files:

git stash --include-untracked

#For Exception:

git pull origin master --allow-unrelated-histories

#for marge conflict:

git commit -a
[Warning !!! Before Pushing Solve the merge conflict manually and then again commit -> then push]

#for "! [rejected] master -> master (non-fast-forward)"

git pull origin master
git fetch origin
git merge origin/master
git pull --rebase origin master
git push origin master

#for "! [rejected] brach -> branch (non-fast-forward)"



git fetch origin
git fetch origin branch_name
git merge/branch_name

Then solve merge conflict and commit.

#Forcely push:

git push --force origin master

#For set Username and Email:

git config --global user.name "user_name"
git config --global user.email "user_email"
git remote rm origin

#For Branch Create:

git checkout -b <branch-name>
git pull origin <branch-name>

#For Brance Clone:

git clone -b <branch-name> <remote_repo>

#For Branch Rename:

git branch -m new_branch /* Current branch will be rename locally */
git push --set-upstream origin new_branch /* Push the new branch, set local branch to track the new remote */

#For Branch Delete:

git push origin --delete <branch-name>

#fatal: refusing to merge unrelated histories:

git pull origin branchname --allow-unrelated-histories

#Delete Recently Pull Request:

git reset --hard HEAD^1

#If you want to see what you haven't git added yet:

git diff your_file_name.php

#Already added changes

git diff --cached your_file_name.php

#Will show you changes you added to your worktree from the last commit:

git diff HEAD your_file_name.php

About

Essential git Command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors