Skip to content

Latest commit

 

History

History
102 lines (79 loc) · 1.83 KB

git.md

File metadata and controls

102 lines (79 loc) · 1.83 KB

git

config

# Set user information
git config --global user.name "Mona LISA"
git config --global user.email "[email protected]"

# Set proxy
git config --global http.proxy http://<url>:<port>
# Unset proxy
git config --global --unset http.proxy

# List configuration
git config --list
# List configuration with origin
git config --list --show-origin

log

git log --graph --all

commit

# Commit all modified/deleted files (but no new unstagged files)
git commit -a
git commit --all

# Amend commit
git commit --amend
# Keep the commit information message, author and author date (but override commiter and commiter date)
git commit --amend -C HEAD
git commit --amend --reuse-message HEAD

rebase

git rebase master

diff

# Compare working area to stage area
git diff
# Compare stage area to repository
git diff --staged
# Compare working area to repository
git diff HEAD

reset

# Undo last commit, keep in stage area
git reset --soft HEAD~1
# Undo last commit, keep in working area
git reset --mixed HEAD~1
git reset HEAD~1 #--mixed is the default mode
# Undo last commit, lost
git reset --hard HEAD~1

branch

# Open UI that display the graph of all branches
gitk --all

# Delete locally remote branches non-existent on remote repositories
git fetch --prune

# Display all branches, those with the tag [gone] they no longer exist on the remote
git branch -v

remote

# Display remote with urls (fetch/push)
git remote -v
# Show remote's informations
git remote show origin
# Set url's remote
git remote set-url origin <remote_url>

submodule

git submodule add https://github.com/dotnet/efcore.git submodule/efcore 
cd submodule/efcore
git checkout v3.1.32
cd ../..
git commit -m "add git submodule efcore at v3.1.32"