Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 1.15 KB

File metadata and controls

78 lines (55 loc) · 1.15 KB

Git Workshop Cheat Sheet

Creating a feature branch

git checkout main
git branch <your branch name>
git checkout <your branch name>

Shorter version:

git checkout main
git checkout -b <your branch name>

Adding new content

Add new commits to your local branch (just a recall):

git add .
git commit -m "<your commit message>"

Push to GitHub (remote) for the first time:

git push --set-upstream origin <your brance name>

Push to Github (remote), if the branch is already pushed:

git push

Getting changes from others

Update your branch (main or feature).

git pull

Updating your branch with the main/development

  1. Change to main.
  2. Pull main.
  3. Change to your feature branch.
  4. Merge main to your feture branch.
git checkout main
git pull
git checkout <your feature branch>
git merge main

A shorter version:

  1. Change / stay on your feature branch.
  2. Fetch the changes from GitHub (remote).
  3. Merge origin/main to your feature branch
git checkout <your feature branch>
git fetch
git merge origin/main

Listing remote repositories

git remote -v