mirror of
https://github.com/denisidoro/navi.git
synced 2024-11-09 23:38:08 +03:00
80 lines
1.7 KiB
Plaintext
80 lines
1.7 KiB
Plaintext
% git
|
|
|
|
# Set global git user name
|
|
git config --global user.name <name>
|
|
|
|
# Set global git user email
|
|
git config --global user.email <email>
|
|
|
|
# Initializes a git repository
|
|
git init
|
|
|
|
# Adds a remote for a git repository
|
|
git remote add <remote_name> <remote_url>
|
|
|
|
# Checkout to branch
|
|
# Change branch
|
|
git checkout <branch>
|
|
|
|
# Displays the current status of a git repository
|
|
git status
|
|
|
|
# Displays the changes made to a file
|
|
git diff <filename>
|
|
|
|
# Stages a changed file for commit
|
|
git add <filename>
|
|
|
|
# Stages all changed files for commit
|
|
git add .
|
|
|
|
# Saves the changes to a file in a commit
|
|
git commit -m <message>
|
|
|
|
# Pushes committed changes to remote repository
|
|
git push -u <remote_name> <branch_name>
|
|
|
|
# Pushes changes to a remote repository overwriting another branch
|
|
git push <remote_name> <branch>:<branch_to_overwrite>
|
|
|
|
# Overwrites remote branch with local branch changes
|
|
git push <remote_name> <branch_name> -f
|
|
|
|
# Pulls changes to a remote repo to the local repo
|
|
git pull --ff-only
|
|
|
|
# Merges changes on one branch into current branch
|
|
git merge <branch_name>
|
|
|
|
# Displays log of commits for a repo
|
|
git log
|
|
|
|
# Displays formatted log of commits for a repo
|
|
git log --all --decorate --oneline --graph
|
|
|
|
# Clear everything
|
|
git clean -dxf
|
|
|
|
# Sign all commits in a branch based on master
|
|
git rebase master -S -f
|
|
|
|
# See all open pull requests of a user on Github
|
|
url::open 'https://github.com/pulls?&q=author:<user>+is:open+is:pr'
|
|
|
|
# Add a new module
|
|
git submodule add <repository> [<path>]
|
|
|
|
# Update module
|
|
git submodule update --init
|
|
|
|
# Update module without init
|
|
git submodule update
|
|
|
|
# Pull all submodules
|
|
git submodule foreach git pull origin master
|
|
|
|
# Update all submodules
|
|
git submodule update --init --recursive
|
|
|
|
$ branch: git branch | awk '{print $NF}'
|