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

Update gitlab-commit_and_push.ipynb

parent 90103581
No related branches found
No related tags found
No related merge requests found
%% 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
git checkout branch_name git checkout branch_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
git pull origin branch_name git pull origin branch_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
git add /filepath/usvi-transportation/gis git add /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
git commit -m "initial commit" git commit -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")
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
(syntax: git push origin branch_name) (syntax: git push origin branch_name)
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
git push origin branch_name git push origin branch_name
``` ```
......
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