61 lines
1.3 KiB
Plaintext
61 lines
1.3 KiB
Plaintext
|
% git
|
||
|
|
||
|
# Initializes a git repository
|
||
|
git init
|
||
|
|
||
|
# Clone a git repository
|
||
|
git clone <repository> <clone_directory>
|
||
|
|
||
|
# Rebase upstream master into local/origin master
|
||
|
git fetch <remote_name>
|
||
|
git checkout master
|
||
|
git rebase <remote_name>/master
|
||
|
git fetch origin
|
||
|
git push -f origin master
|
||
|
|
||
|
# Merge upstream master into local/origin master
|
||
|
git fetch <remote_name>
|
||
|
git checkout master
|
||
|
git merge <remote_name>/master
|
||
|
git fetch origin
|
||
|
git push -f origin master
|
||
|
|
||
|
# Adds a remote for a git repository
|
||
|
git remote add <remote_name> <remote_url>
|
||
|
|
||
|
# Renames a remote for a git repository
|
||
|
git remote rename <old_remote_name> <new_remote_name>
|
||
|
|
||
|
# Remove a remote for a git repository
|
||
|
git remote remove <remote_name>
|
||
|
|
||
|
# Saves the changes to a file in a commit
|
||
|
git commit -m <message>
|
||
|
|
||
|
# Pushes committed changes to remote repository
|
||
|
git push --set-upstream <remote_name> <branch_name>
|
||
|
|
||
|
# Displays formatted log of commits for a repo
|
||
|
git log --all --decorate --oneline --graph
|
||
|
|
||
|
# Clear everything
|
||
|
git clean -dxf
|
||
|
|
||
|
# 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
|
||
|
|
||
|
# Skip git hooks
|
||
|
git commit --no-verify
|
||
|
|
||
|
# Create new branch from current HEAD
|
||
|
git checkout -b <new_branch_name>
|