Skip to content

Basic Git Tutorial

0NotApplicable0 edited this page Apr 28, 2021 · 4 revisions

Useful Git commands:

Firstly make sure you have created an account on Github.

Branches: (allowing people to be working on different features simultaneously)

Line for creating a branch:

    git checkout -b name_of_branch

Switching between branches:

    git checkout name_of_branch

Update branch and get any changes to the branch:

    git pull

Show non-staged differences in local repo:
  
    git diff 

Show differences between branches

    git diff name_of_branch_1 name_of_branch_2 

Merge branches (adding changes from one branch to another):

    git merge name_of_branch

Delete branch
    
    git branch -d name_of_branch

Adding/Committing/Push:

**Please do not ever commit to the master branch**   

git add filepath (for adding a file)

git commit -m name_of_commit (commits the changes added prior)

git push origin name_of_branch (pushes changes to the branch named, again should not be the master branch)

External Resources: Git is easy to pickup but can be hard to master. Take a look at these resources for more info:

Clone this wiki locally