"Choose branch you would like to work on. (syntax: git checkout branch_name) \n",
"Choose branch you would like to work on. (syntax: git checkout branch_name) \n",
"If you need to create a new branch, type this to create a branch and switch to it: git checkout -b 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:markdown id: tags:
%% Cell type:markdown id: tags:
### About
### About
This notebook is for the following functions:
This notebook is for the following functions:
- making a commit
- making a commit
- pushing changed files and/or new files from your computer to GitLab
- pushing changed files and/or new files from your computer to GitLab
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Startup git
# Startup git
Replace /filepath/filename with the filepath of your git repository. For example, if you want to work in the usvi-transportation repository, use
Replace /filepath/filename with the filepath of your git repository. For example, if you want to work in the usvi-transportation repository, use
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
cd/example/filepath/usvi-transportation
cd/example/filepath/usvi-transportation
```
```
%% Cell type:markdown id: tags:
%% 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
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:
%% Cell type:code id: tags:
``` python
``` python
gitcheckoutbranch_name
gitcheckoutbranch_name
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Pull
# Pull
Always pull before working on files to ensure you have the most up-to-date version of your branch.
Always pull before working on files to ensure you have the most up-to-date version of your branch.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
gitpulloriginbranch_name
gitpulloriginbranch_name
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Make a Commit
# Make a Commit
Use this to finalize a file edit or addition and provide a reason
Use this to finalize a file edit or addition and provide a reason
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
<h4>Step 1</h4>
<h4>Step 1</h4>
Make a change to your file, or place a new file to be pushed somewhere in your local git folder structure.
Make a change to your file, or place a new file to be pushed somewhere in your local git folder structure.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
<h4>Step 2</h4>
<h4>Step 2</h4>
Choose file to commit. Replace /filepath/filename with the filepath and the filename 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.) For example, if you would like to add the gis folder in the usvi-transportation repository, use the following file path:
Choose file to commit. Replace /filepath/filename with the filepath and the filename 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.) For example, if you would like to add the gis folder in the usvi-transportation repository, use the following file path:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
gitadd/filepath/usvi-transportation/gis
gitadd/filepath/usvi-transportation/gis
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
<h4>Step 3</h4>
<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".
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:
%% Cell type:code id: tags:
``` python
``` python
gitcommit-m"initial commit"
gitcommit-m"initial commit"
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Push
# Push
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")
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")