Skip to content

Commit

Permalink
added shortened version of commit/push
Browse files Browse the repository at this point in the history
  • Loading branch information
mgimond committed Feb 29, 2024
1 parent 589ed3f commit 84ef726
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
- [Cloning a Github repo to your computer](Cloning_a_Github_repo.md)
Instructions on cloning/pulling a repo from Github.com to your local computer using `git`. Make sure that you have a PAT token created for the machine you will work on.

- [Staging and committing changes made to a local repo](stage_commit.md)
- [Staging/committing and pushing a local repo](stage_and_push.md)
Instructions on staging, committing and pushing

- [Staging and committing--detailed](stage_commit.md)
Instructions on staging and committing changes made in your local repo project folder. Changes include files that were added/removed or modified.

- [Pushing a local repo to Github](push_repo_to_github.md)
- [Pushing a local repo to Github--detailed ](push_repo_to_github.md)
Instructions **pushing** these changes back to your Github.com account.

- [Updating a local repo](Update_local_repo.md)
Expand Down
45 changes: 45 additions & 0 deletions stage_and_push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Proceed with the following steps when you are ready to stage, commit, then push (upload) your local project folder back to your github account. Note that you do not need to wait until you feel as though you have a final version of your assignment or project before pushing it to your github account. You can push many different versions of you project folder as needed.

1. Make sure that you've saved all R/Rmd scripts before proceeding.

2. In a terminal, place yourself in the project folder (aka repo folder) using the `cd` command (see [here](Cloning_a_Github_repo) for a refresher on navigating directories in a terminal). To check that you are indeed in the project folder, type `pwd`

3. Stage, then commit the changes made to your project folder. These **commits** act as "bookmarks"" in the evolution of your project folder. Type the following:

```
git add --all
git commit -m "type your message here"
```

When committing changes, be sure to add a meaningful message in between the quotes. The message is what you use to track various versions of your commit.

4. Check that your changes have been properly committed using the `git status` command. You should see a message along the lines of `"Your branch is ahead of 'origin/main' by X commits"`.

<img src="img/status_clean.png" width=450 />


4. The final step is to **push** your local committed files/folders to your Github repo as follows:

`git push -u origin main`

or simply:

`git push`


On a Mac, you may be prompted for a password.

<img src="img/git_push.PNG" width=450 />
3. Finally, check your Github repo for the updates. You should see the comment next to the updated or newly added files. The following snapshot assumes that the repo is named `HW123`.

<img src="img/check_github.PNG" width=600 />

-----

[Back to the home page](index.html)

<div class="footer">
<hr/>
<a rel="license" href="https://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/80x15.png" /></a> Manny Gimond (2022)
</br>

0 comments on commit 84ef726

Please sign in to comment.