This is a cheat-sheet to go along with the stream I did on Scrimba YouTube channel about git and GitHub.
I've recently gone on a Scrimba Livestream to talk about git and Github. I love simple workflows with git and this is my cheat-sheet to use. Feel free to hit me up on twitter or Scrimba Discord if you have any questions. Also if you spot something not right, raise a PR π. (Details below)
Contributing to a repo
Pick a repo, fork it (optional) and clone it.
Alternatively, create a new one.
# replace the below URL with the repo in your account that you want to work with
git clone https://github.com/alanmynah/alanmynahdotcom.git
Then just follow Branching steps
Branching
# create a new branch and switch to it
git checkout -b new-branch
# connect the local new branch to the remote counter part
git push --set-upstream origin new-branch
Now follow the steps in My daily workflow
My daily workflow
# add all the files
git add .
# commit
# tips on helpful commit messages:
# https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/
git commit -m "type: brief description (<50 chars) of work done"
# push
git push
After a few commits, raise a PR.
When done, don't forget to Pull after a PR
Pull after a PR
git status # should be on the branch
git checkout main
git pull
Then pick a new feature and create new branch as described in Branching section
Creating a repo
Create a repository locally (like via CRA), go to github.com, create a repository via UI.
Copy and paste the steps from the outline in β¦or push an existing repository from the command line
.
These are the steps:
create-react-app my-blog
# these are pasted from `β¦or push an existing repository from the command line` section when new repo is created.
git remote add origin https://github.com/alanmynah/my-blog.git
git branch -M main
git push -u origin main
Top comments (0)