Download git for your operating system at: https://git-scm.com/downloads
Download VS Code https://code.visualstudio.com/
Configure user information for all local repositories
# Sets the name you want attached to your commit transactions
$ git config --global user.name "[name]"
# Sets the email you want attached to your commit transactions ( use Github email)
$ git config --global user.email "[email address]"
Create a folder and init Git
# create a folder
$ mkdir git_workshop
$ cd git_workshop
# init git
$ git init
Add README.md file to your folder.
# you can use VScode to open the folder and create the file
touch README.md
See changes that have been made
git diff
Adding files to commit
git add README.md
#or
git add .
Committing files with commit message, this will stage your changes
git commit -m "initial commit "
Branches are an important part of working with Git.
Any commits you make will be made on the branch you’re currently “checked out” to.
Use git status to see which branch that is.
Creates a new branch
$ git branch [branch-name]
$ git checkout -b [branch-name]
Switches to the specified branch and updates the working directory
$ git checkout [branch-name]
Combines the specified branch’s history into the current branch. This is usually done in pull requests, but is an important Git operation.
$ git merge [branch]
Deletes the specified branch
$ git branch -d [branch-name]
Show all available branches
git branch -a