Skip to content
Snippets Groups Projects
Commit bd91a768 authored by Wigal, Jacob (CIV)'s avatar Wigal, Jacob (CIV) :sparkles:
Browse files

updated instructions

parent 307fec06
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
### About
This notebook is for the following functions:
- making a commit
- pushing changes to remote repository
%% Cell type:markdown id: tags:
# Run First
# Startup git
Replace /users/filepath/etc with the filepath of the local git directory you wish to work on.
Replace /example/filepath/etc with the filepath of your git directory.
%% Cell type:code id: tags:
``` python
cd /Users/filepath/etc
cd /example/filepath/etc
```
%% Cell type:markdown id: tags:
Choose branch you would like to work on. (syntax: git checkout branch_name)
Choose branch you would like to work on. (syntax: git checkout branch_name) \
If you need to create a new branch, type this to create a branch and switch to it: git checkout -b branch_name
%% Cell type:code id: tags:
``` python
git checkout develop
git checkout branch_name
```
%% Cell type:markdown id: tags:
# Pull
Always pull before working on files with git to ensure you have the latest version.
%% Cell type:code id: tags:
``` python
git pull origin branch_name
```
%% Cell type:markdown id: tags:
# Make a Commit
Use this to finalize a file edit and provide a reason
%% Cell type:markdown id: tags:
<h4>Step 1</h4>
Make a change to your file
%% Cell type:markdown id: tags:
<h4>Step 2</h4>
Choose file to commit. Replace /example/filepath/etc with path of file you would like to commit. (Note: If you would like to commit multiple files at once with the same commit message, you can do so by adding the parent folder of all edited files. Git will only apply this commit message to files that have changes.)
Choose file to commit. Replace /example/filepath/etc with the filepath of the file you would like to commit. (Note: If you would like to commit multiple files at once with the same commit message, you can do so by adding the parent folder of all edited files.)
%% Cell type:code id: tags:
``` python
git add /example/filepath/etc
```
%% Cell type:markdown id: tags:
<h4>Step 3</h4>
Place your reason for the commit inside quotes. If this is a new file to the repository, simply put "initial commit".
%% Cell type:code id: tags:
``` python
git commit -m "initial commit"
```
%% Output
[master 916ccdb] removed 96, deleted fiber
3 files changed, 0 insertions(+), 0 deletions(-)
%% Cell type:markdown id: tags:
# Push
Use this to update files in the remote repository with your committed files. Note: You may run into errors if the local branch you are pushing does not have the same name as the remote branch you are pushing to (e.g. trying to push from a local branch named "testing" to a branch in the GitLab repository named "develop"). It is recommended you push from a branch with the same name as the remote branch you are trying to push to.
Use this to update files in the remote repository with your committed files. Only try to push to branches with the same name as the one on your machine. (e.g. if you want to push a branch named "nps-develop", you should type "git push origin nps-develop")
%% Cell type:markdown id: tags:
See a list of all files you have made commits to since your last push.
(syntax: git push origin branch_name)
%% Cell type:code id: tags:
``` python
git status
git push origin branch_name
```
%% Cell type:markdown id: tags:
(syntax: git push remote_name branch_name)
%% Cell type:code id: tags:
``` python
git push origin develop
```
%% Output
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.60 KiB | 1.60 MiB/s, done.
Total 7 (delta 6), reused 0 (delta 0)
To https://gitlab.nps.edu/CID/USVI/gis.git
ea4ee4c..916ccdb master -> master
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment