Skip to content

jolyphil/git-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

git-cheatsheet

Frequently used series of commands in Git

Start a new branch and push it to GitHub

  1. Create and switch to a new branch (here: featurebranch)
git checkout -b featurebranch
  1. Examine your branches
git branch -vv
  1. Stage and commit your changes
git add myfile
git commit -m "My commit message"
  1. Push the new branch to GitHub
git push origin featurebranch
  1. Start tracking the remote branch
git branch -u origin/featurebranch
  1. Create a pull request on GitHub

  2. Continue committing on the branch and pushing while discussing development with collaborators on GitHub

Merge a local branch, delete a local branch, push changes, delete a remote branch

  1. Switch to receiving branch (here main)
git checkout main
  1. Merge feature branch (here: featurebranch)
git merge featurebranch
  1. (Eventually manage merge conflict)

  2. Delete local feature branch

git branch -d featurebranch
  1. Push changes to main
git push
  1. Delete remote branch
git push origin --delete featurebranch

About

Frequently used series of commands in Git

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published