Resources
Shortcuts
alias ga='git add'
alias gaa='git add -A'
alias gb='git branch'
alias gca='git commit -a -m'
alias gcm='git commit -m'
alias gc='git clone --recurse-submodules'
alias go='git checkout'
alias gob='git checkout -b'
alias god='git checkout develop'
alias gs='git status'
alias gp='git push'
function gpu
set -l git_branch (git rev-parse --abbrev-ref HEAD)
git push --set-upstream origin $git_branch
end
alias gm='git merge'
alias gf='git fetch'
alias gru='git remote update origin --prune'
alias gst='git stash'
alias gstp='git stash pop'
alias gsta='git stash apply'
alias gstc='git stash clear'
alias gsw='git switch -c '
alias gl='git pull'
alias gsu='git submodule update --init --recursive'
alias gr='git rebase -i'
alias gre='git rebase --edit-todo'
alias grc='git rebase --continue'
Cheatsheet
- To migrate changes to another branch:
git stash
git checkout <branch>
git stash apply
- To create a new branch and move all your changes to that branch:
git switch -c <new-branch>
- Commit changes:
git add <files>
. Use *
for all files
git commit -m "<message>"
git push
- Create a local branch and move to it:
git checkout -b <branchName>
- Delete a local branch:
git branch -d <branchName>
- Rebasing
upstream/main
:
- Fetch upstream changes:
git fetch upstream
- Rebase:
git rebase upstream/main
- Resolve conflicts with VS Code
- Push changes:
git push --force
- ⚠️ Do not push from VS Code
- Move current changes to a new branch:
git switch -c <newBranch>
- Undoing last commit pushed:
git reset --hard HEAD~<number_of_commits>
git push --force
- Amending last commit in VS Code:
…
> Commit
> Commit staged (amend)
…
> Push/Pulls
> Force push
Usual Workflow
- Fork the repository