---
# System prepended metadata

title: Github CLI notes
tags: [Random]

---

---
tags: Random
title: Github CLI notes
---

# Github CLI notes

> Quick example of how to send changes perfomed on our local computer to github. This needs to be in the github repository on our local computer (so after, e.g., doing `git clone` to get it on our computer). My short notes on setting up github access can be found [here](https://hackmd.io/@astrobiomike/setting-up-github-access).

[toc]

## tl;dr

```bash
git status
git add *
git commit -m "message about what we changed/added goes here"
git push
```

This example is with my happy belly github.

## Checking status
`git status` checks if there have been any changes from how it was pulled from github. This is before I made any changes:

```bash
git status
```

![](https://i.imgur.com/IDVHOsk.png)

After making a change:

![](https://i.imgur.com/r4X9ysM.png)


## Adding changes to be committed
Things can be added as individual files if wanted, or all changes can be added like so:

```bash
git add *
```

```bash
git status
```

![](https://i.imgur.com/IugSgTc.png)


## Committing changes
The `commit` needs to have a message attached to it, useful to describe what we're changing or adding. That an be provided with the `-m` flag as shown here:

```bash
git commit -m "small change for git CLI example"
```

![](https://i.imgur.com/Fuf2TDF.png)


```bash
git status
```

![](https://i.imgur.com/Fjz5QOI.png)

Now the status says we are ahead of "origin/master" (the GitHub repository) by 1 commit.

## Pushing changes to GitHub

```bash
git push
```

![](https://i.imgur.com/CJ8lqh8.png)

And now the changes are updated in GitHub, and anyone can access the latest, e.g:

![](https://i.imgur.com/1C5C1bi.png)



