Git guide - fredrikbjaras/CarShare GitHub Wiki

Git guide

General

  • To clone down the repository: git clone “repository url”

  • Check status of git branch: git status

Branches

  • To create and use a branch: git checkout -b “branch name” Git push origin “branch name”

  • Change to a branch: git checkout "branch name"

  • Copy a branch to a new branch: git checkout -b new_branch old_branch

  • To merge the branch to master: Go to github and press “new pull request” and specify master ← branch. Pull request must be authorized by testing group to be added to main

Adding and updating

  • Update branch from repository: git pull

  • Update branch from main: git pull origin master

  • To add a file to a commit for the current branch: git add “file”

  • To create finalize the commit: git commit -m "message"

  • To push a commit to the current branch: git push