Knowing how to use git in the command line is not necessary but I would recommend using it so you know how Git actually works. Here are some of the basic commands that are used a lot.
Initializing a Local Git Repository
Make sure you are in the folder that you want to initialize the git repository and use this command.
$ git init
Adding the File
This command is important. It moves the file into the staging area and must be done before you commit a file. Here are several ways you can call this.
$ git add <file name>
Committing the File
This command is used to move the file from the staging area to a commit. Where it takes a snapshot of the changes made.
$ git commit -m “commit message”
See the Status of the Working Tree
Lets you know which files are not being tracked and if you have to add or commit any of the files.
$ git status
Creating a Branch
You can create a branch if you want to experiment on a file without making changes to the master branch.
$ git checkout -b <branch name>
$ git branch <branch name>
Switching Between Branches
This is how you switch between branches so you are not making changes in the wrong branch.
$ git checkout <branch name>
Display all Branches
Displays all of the branches in the git repository.
$ git branch
Delete a Branch
This command allows you to delete a branch locally.
$ git branch -d <branch name>
Copying a Branch
Copies a branch to another branch. Make sure you are on the branch you want to copy to. Then use this command.
$ git merge <branch you want to copy from>