Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# List all local branches (* marks the current branch): git branch # List all branches including remote tracking branches: git branch -a # Create a new branch: git branch feature/user-login # Switch to an existing branch: git switch feature/user-login # Create and switch in one step (preferred): git switch -c feature/user-login # Old syntax (still valid): # git checkout -b feature/user-login # Rename a branch: git branch -m old-name new-name # Delete a merged branch: git branch -d feature/user-login # Force-delete an unmerged branch: git branch -D feature/abandoned # See the last commit on each branch: git branch -v # See which branches are merged into the current one: git branch --merged # HEAD — pointer to the current branch (or commit): cat .git/HEAD # ref: refs/heads/feature/user-login
Result
Open