zhenluo666/GitTutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 

Repository files navigation

git clone https://.com/zhenluo666/GitTutorial

git init
git remote add origin https://.com/zhenluo666/GitTutorial

git status

git add {filename}

git add .
git add *
git add -A

git restore {filename}

git commit -m "updated the README with more commands"

git add . && git commit -m "add more lines"

git log

git push
git push -u origin main
git push origin {new_remote_branch}

git fetch
git fetch {remote_repository} {remote_branch}

git pull
git pull origin {remote_branch}:{local_branch}
git pull {remote_repository} {remote_branch}:{local_branch}
git checkout -b {new_local_branch} origin/{remote_branch}
% Note pull may create merge conflict between remote and local that you need to be fix and commit the change

:q
:q!
:wq

git config --global --edit

git --help

git reset {filename}

git reset --hard origin/{branch_name}

git remote -v
git branch -a

git diff {main_branch} {new_branch}

git branch {new_branch}
git branch {new_branch} {base_branch}
git branch {new_local_branch} {remote_repository}/{remote_branch}
git checkout -b {new_branch}
git checkout -b {new_local_branch} origin/{remote_branch}

git checkout {branch_name}

git branch --list
git branch -D {branch_to_be_deleted}
git branch -M {branch_to_be renamed}
git branch -C {branch_to_be_copied}
git push origin --delete {remote_branch_to_be_deleted}

git merge {branch_name}
git fetch origin {remote_branch} && git merge origin/{remote_branch}
git fetch {remote_repository} {remote_branch} && git merge {remote_repository}/{remote_branch}
% There may be merge conflict which needs your check into files and make modifications
% Merge conflict has to be resolved before switch branch

About

Basic git commands used in workflow

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published