umma.dev

Git Commands

Git is a version control system which enables you to organise your code/projects and review changes.

Creating Repositories

Create a new local repo with a given name ``` git init ``` Create a new local repo within a folder ``` git init ``` Clone repo locally ``` git clone ```

Making Changes

Show all files that have been changed ``` git status ``` Add all files that have been changed ``` git add . ``` Add specific file ``` git add ``` Commit files ``` git commit -m

<h3>Branches</h3>
Create a new branch within a repo

git branch

Create and switch to new branch

git b checkout

Switch to a branch

git checkout -b

Merge branch

git merge

Delete branch

git branch -d


<h3>Removing Files</h3>
Remove file from local and stage

git rm

Remove file from Github/Gitlab but keep locally

git rm β€”cached


<h3>Making Changes to Remote Repo</h3>
Stage changes to repo in Github/Gitlab

git push