list branches
git branch
create (and checkout) new branch
git checkout -b crazy-experiment
delete branch (after merging)
git branch -d crazy-experiment
delete branch (not merged but you don't want the branch anymore)
git branch -D crazy-experiment

The above command will not delete the branch in the remote repo. To delete the branch in the remote repo as well do the following

delete remote branch
git push origin --delete crazy-experiment
git push origin :crazy-experiment

rename local branch
#checkout branch you want to rename
git checkout crazy-experiment
#rename it
git branch -m failed-experiment
diff file on another branch
#see what changed with user.rb on another commit or branch
git diff aa6d804 -- app/models/user.rb

  • 0 posts
  • 2 subtopics
  • 6 months ago by vince