Git workflow management including branching, commits, PRs, and conflict resolution
Use me when working with Git, especially when:
git status - Show working tree statusgit diff - Show unstaged changesgit diff --staged - Show staged changesgit add . - Stage all changesgit commit -m "message" - Commit staged changesgit commit --amend - Modify last commitgit branch feature-name - Create branchgit checkout -b feature-name - Create and checkout branchgit checkout main - Switch to main branchgit merge feature-name - Merge branchgit rebase main - Rebase current branch onto maingit push -u origin feature-name - Push branch with upstreamgit pull --rebase - Pull with rebasegit log --oneline -10 - Show last 10 commitsgit log -p --follow file - Show file historyfeature/feature-namebugfix/issue-descriptionhotfix/critical-fixrelease/version-numbergit branch -d feature-nameCloses #123 or Refs #456git status to find conflicts<<<<<<<, =======, >>>>>>>)git add filegh pr create - Create pull requestgh pr list - List pull requestsgh pr view 123 - View PR detailsgh pr merge 123 - Merge PRgh issue list - List issuesgh repo clone org/repo - Clone repositorygit rebase -i HEAD~3 to edit commitsgit status before destructive commandsmain, master)--dry-run flag with cautiongit reflog if you lose commitsgit add -p - Stage changes interactively (hunks)git commit -v - Show diff when committinggit rebase -i - Interactive rebase to edit/squash commitsgit clean -fd - Remove untracked files and directories (use with caution)git restore file - Discard changes in working directory