---
# System prepended metadata

title: Learning Github

---

# Learning Github

- [x] Create a directory/folder called `learning-git`
- [x] Open this directory in VSCODE
- [x] Create a text file called `some-text.txt`
- [x] Open Terminal
- [x] Run `ls` command to list all files in the current directory
- [x] Run `pwd` command to find out which directory you are in
- [x] Find out what options we have using `git --help`
- [x] Convert this directory into a git repo by initialising git with `git init` - git will start tracking changes in this directory now
- [x] Ask git to list out all the things that have changed in the current directory using `git status`
- [x] Tell git to track the latest changes with `git add filename-to-be-tracked`
- [x] Commit the file with `git commit filename`
- [x] Create a new branch from `master` called `task/new-para` with `git checkout -b branchname`
- [x] Create a new repository called `learning-git`
- [ ] Follow onscreen commands to push your changes to Github
- [ ] Create and commit a new file called `text-3.txt` on local machine
- [ ] Push the changes to GH


## Git Commands you should know

- [ ] `git status` - to see the status of changes. inthe working directory
- [ ] `git add` - to tell Git to track changes in working directory
- [ ] `git commit` - to tell Git to save the changes as the latest state

```
# Tell Git to add a remote repository, call it as origin and point to the provided addess
git remote add origin git@github.com:larry-dalmeida/learning-git.git

# Tells Git to rename the current branch (master by default) to main
git branch -M main

# Tells Git to push the main branch on my local machine to the remote repository pointed to by the name origin
git push -u origin main
```


## Common Commandline Commands

- `ls -la` - to list all files in the current working directory
- `cd dirname` - to change directory to `dirname`
- `cd ..` - to go back one level
- `rm -rf dirname` - to forcefully delete all contents of `dirname`
- `rm filename` - to delete file called `filename`