diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/01-introduction.html b/01-introduction.html new file mode 100644 index 0000000..b85e894 --- /dev/null +++ b/01-introduction.html @@ -0,0 +1,572 @@ + +Git for Official Statistics: Introduction +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Introduction

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • Why use version control in official statistics?
  • +
+
+
+
+
+
+

Objectives

+
  • Identify uses and purposes for using Git in official statistics
  • +
+
+
+
+
+

Version Control in General +

+

Version control is important whether you are working alone or +collaboratively, even if you are not working in statistics!

+

Here’s the basics of how a version control system works:

+
  • start with a base version of a document
  • +
  • record changes made each step of the way
  • +
  • collaborators can add changes in independently without conflict
  • +
Web comic about sending a file back and forth using the file name as version control

You’ve probably already seen a version control system.

+

Good version control systems will allow you to see the history of a +project and will sync across different computers, facilitating +collaboration.

+
+
+ +
+
+

Version Control Systems +

+
+

What version control systems have you likely already come across? +List 1-2

+
+
+
+
+
+ +
+
+

You’ve probably seen Microsoft’s Track Changes and Google Doc’s +version history

+
+
+
+
+

Why Version Controlling Matters in Official Statistics +

+

There are a number of reasons why version control matters matters in +official statistics:

+
  1. Reproducibility: Within and across organizations, we need to be +able to reproduce statistics. This could be to ensure consistency in +methodology across reference periods, or check to see if statistics are +comparable in their methodologies.

  2. +
  3. Standardization: We can use version control systems as a single +source of truth to create standardization of statistics between and +within organizations.

  4. +
  5. Disseminate changes and updated versions: Following our single +source of truth, we can easily update and share changes to calculations +of official statistics as well as any new documentation or +methodologies. This means we are updating in one place rather than +many.

  6. +
  7. Collaboration: Version control systems allow us to collaborate +and connect on the creation of official statistics internally and +externally with stakeholders. We can use these systems to share proposed +changes, share work, and test code.

  8. +
  9. Efficient and Effective Development of Code: With a single source +of truth, we know exactly where to propose and find changes code that +makes our statistics. In addition, many version control systems have +project management or feedback tools that we can leverage to bundle +communication and discussion with the code itself rather than working in +multiple systems. This can allow for faster feedback and proposed +updates.

  10. +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/02-version_control.html b/02-version_control.html new file mode 100644 index 0000000..a59c250 --- /dev/null +++ b/02-version_control.html @@ -0,0 +1,518 @@ + +Git for Official Statistics: Version Control +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Version Control

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • What is Git?
  • +
  • Why should I use it?
  • +
  • How does it relate to open statistics?
  • +
+
+
+
+
+
+

Objectives

+
  • Identify key concepts in version control and its use in official +statistics
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/03-git_setup.html b/03-git_setup.html new file mode 100644 index 0000000..f85429a --- /dev/null +++ b/03-git_setup.html @@ -0,0 +1,693 @@ + +Git for Official Statistics: Setting up Git +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Setting up Git

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I set up Git?
  • +
+
+
+
+
+
+

Objectives

+
  • Configure basic settings in Git
  • +
+
+
+
+
+

Before we start using Git for the first time on a new computer, there +are some things we need to set up. In this lesson, we will:

+
  • Add a name and email address
  • +
  • Set the text editor used for writing commit messages
  • +
  • Understand the difference between --global and +--local configuration
  • +
  • View/confirm configuration settings
  • +

We will be using Git Bash, the command line interface for Git.

+

Configure Name and Email +

+

An important first step in using Git is adding your name and email. +This information will be attached to commits, +branches, +and other changes you make in the future. This identifiability and +accountability for code changes is one of the key benefits to using +Git.

+

At the Git Bash prompt, enter the following, substituting your full +name for the name in quotation marks after user.name and +your email for the email address following user.email.

+
+

BASH +

+
$ git config --global user.name "Jane Doe"
+$ git config --global user.email "doe_jane@agency.gov"
+
+

Your situation may vary, but if you are writing code in your official +capacity and using an agency repository, you will most likely want to +use your official email address and the one associated with your account +on GitHub, GitLab, or other code sharing site.

+

Configure Text Editor +

+
+

This is optional. By default, Git Bash will use the Vim text +editor.

+
+

There are many different Git clients and ways of interacting with Git +on your computer. Some clients have a full user interface that you use +for selecting files to stage for commits and authoring commit messages. +Others, like Git Bash, have a command line interface so when you want to +write a lengthy commit message, it needs to call up a text editor.

+
+
+ +
+
+

Different Ways to Author Commit Messages +

+
+

As you will learn in a +later lesson, once you make updates to your code, you will want to +make a snapshot of those updates called a commit and provide an +informative message that describes what was changed. This message can be +short and be written on the command line (e.g., +git commit -m "Update README.md"). Sometimes however, you +will want to write a longer, multi-line commit message. You can do this +by entering git commit on the command line. This will bring +up the text editor you have configured as your default.

+
+
+
+

The default text editor for Git Bash is Vim which has a reputation +for being difficult, especially for new users. So you may want to change +to something easier to use or something you are more familiar with +(e.g., your favorite text editor).

+

To switch to one of the following editors in the tables below, you +can use the associated configuration commands.

+

The nano text editor is packaged with Git Bash and Notepad is +included in the Windows operating system.

+ + + + + + +
EditorConfiguration command
nano$ git config --global core.editor "nano -w"
Notepad (Win)$ git config --global core.editor "c:/Windows/System32/notepad.exe"

The text editors below are not available by default, but you may be +available to you. Setup for these is more complex because it requires +providing a filepath to the program executable which may not be the same +for everyone.

+ + + + + + + + +
EditorConfiguration command
Notepad++ (Win, 64-bit install)$ git config --global core.editor "'c:/program files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Sublime Text (Win, 64-bit install)$ git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
VS Code$ git config --global core.editor "code --wait"

If you ever want to switch back to Vim as the default, you can run +the following command.

+ + + + +
EditorConfiguration command
Vim$ git config --global core.editor "vim"
+
+ +
+
+

Exiting Vim +

+
+

Vim is surprisingly difficult to exit from. If you wish to exit a +session without saving your changes, press Esc then type +:q! and hit Enter or . If you want +to save your changes and quit, press Esc then type +:wq and hit Enter or .

+
+
+
+

+--global vs. --local +

+

In the code samples above, we have used the --global +flag. These are the settings Git will use for all repositories on your +computer. As your use of Git becomes more complex, you may wish to have +different configuration settings for different repositories. This is +when you might use the --local flag. --local +allows you to set configuration for specific repositories.

+

To set local configuration, open Git Bash and navigate to the +repository you want to configure. You can then use the commands above, +but substitute --local for --global.

+

For example, if you want to set a different name or email address for +a specific project, you can do so with commands like those below.

+
+

BASH +

+
$ git config --local user.name "Jane R Doe"
+$ git config --local user.email "janedoe@example.com"
+
+

These settings will override the --global configuration +settings for that repository only.

+

View/Confirm Configuration +

+

You may wish to check your configuration settings.

+

To see all configuration settings, you can use the following command. +If you are in a repository, this will show all global and local +configuration settings.

+
+

BASH +

+
$ git config --list
+
+

To view global settings only (Note: This command can be run +anywhere):

+
+

BASH +

+
$ git config --global --list
+
+

To view local settings only (Note: This has to be run while +in a repository):

+
+

BASH +

+
$ git config --local --list
+
+

To view specific settings, include the setting name. For example, to +view the email address configuration setting:

+
+

BASH +

+
$ git config user.email 
+
+

Other Configuration Settings +

+

There are other, optional configuration settings you may wish to +change. Review Git documentation and consult with others on your team +about other settings.

+
+
+ +
+
+

Key Points +

+
+
  • Use git config with the --global option to +configure a user name, email address, editor, and other preferences once +per machine.
  • +
  • Use --local in place of --global within a +repository to set repository specific changes.
  • +
+
+
+
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/04-create_repo.html b/04-create_repo.html new file mode 100644 index 0000000..b4fc42f --- /dev/null +++ b/04-create_repo.html @@ -0,0 +1,515 @@ + +Git for Official Statistics: Creating a Repository +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Creating a Repository

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • Where does Git store information?
  • +
+
+
+
+
+
+

Objectives

+
  • Create a repository in a local folder
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/05-track_changes.html b/05-track_changes.html new file mode 100644 index 0000000..bb6c251 --- /dev/null +++ b/05-track_changes.html @@ -0,0 +1,1351 @@ + +Git for Official Statistics: Tracking Changes +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Tracking Changes

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I record changes in Git?
  • +
  • How do I check the status of my version control repository?
  • +
  • How do I record notes about what changes I made and why?
  • +
+
+
+
+
+
+

Objectives

+
  • Check the history of a file
  • +
  • Use add and commit to record changes
  • +
  • Create commit messages that are descriptive
  • +
+
+
+
+
+

Note This lesson has been adapted from Lesson 4 +of Version Control with Git

+

Getting Started +

+

First let’s make sure we’re still in the right directory. You should +be in the planets directory.

+
+

BASH +

+
$ cd ~/Desktop/planets
+
+

Let’s create a file called mars.txt that contains some +notes about the Red Planet’s suitability as a base. We’ll use +nano to edit the file; you can use whatever editor you +like. In particular, this does not have to be the +core.editor you set globally earlier. But remember, the +bash command to create or edit a new file will depend on the editor you +choose (it might not be nano). For a refresher on text +editors, check out “Which +Editor?” in The Unix Shell +lesson.

+
+

BASH +

+
$ nano mars.txt
+
+

Type the text below into the mars.txt file:

+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

Let’s first verify that the file was properly created by running the +list command (ls):

+
+

BASH +

+
$ ls
+
+
+

OUTPUT +

+
mars.txt
+
+

mars.txt contains a single line, which we can see by +running:

+
+

BASH +

+
$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

If we check the status of our project again, Git tells us that it’s +noticed the new file:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Untracked files:
+   (use "git add <file>..." to include in what will be committed)
+
+	mars.txt
+
+nothing added to commit but untracked files present (use "git add" to track)
+
+

The “untracked files” message means that there’s a file in the +directory that Git isn’t keeping track of. We can tell Git to track a +file using git add:

+
+

BASH +

+
$ git add mars.txt
+
+

and then check that the right thing happened:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Changes to be committed:
+  (use "git rm --cached <file>..." to unstage)
+
+	new file:   mars.txt
+
+
+

Git now knows that it’s supposed to keep track of +mars.txt, but it hasn’t recorded these changes as a commit +yet. To get it to do that, we need to run one more command:

+
+

BASH +

+
$ git commit -m "Start notes on Mars as a base"
+
+
+

OUTPUT +

+
[main (root-commit) f22b25e] Start notes on Mars as a base
+ 1 file changed, 1 insertion(+)
+ create mode 100644 mars.txt
+
+

When we run git commit, Git takes everything we have +told it to save by using git add and stores a copy +permanently inside the special .git directory. This +permanent copy is called a commit +(or revision) and its short +identifier is f22b25e. Your commit may have another +identifier.

+

We use the -m flag (for “message”) to record a short, +descriptive, and specific comment that will help us remember later on +what we did and why. If we just run git commit without the +-m option, Git will launch nano (or whatever +other editor we configured as core.editor) so that we can +write a longer message.

+

[Good commit messages][commit-messages] start with a brief (<50 +characters) statement about the changes made in the commit. Generally, +the message should complete the sentence “If applied, this commit will” +. If you want to go into more detail, add a blank +line between the summary line and your additional notes. Use this +additional space to explain why you made changes and/or what their +impact will be.

+

If we run git status now:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

it tells us everything is up to date. If we want to know what we’ve +done recently, we can ask Git to show us the project’s history using +git log:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+

git log lists all commits made to a repository in +reverse chronological order. The listing for each commit includes the +commit’s full identifier (which starts with the same characters as the +short identifier printed by the git commit command +earlier), the commit’s author, when it was created, and the log message +Git was given when the commit was created.

+
+
+ +
+
+

Where Are My Changes? +

+
+

If we run ls at this point, we will still see just one +file called mars.txt. That’s because Git saves information +about files’ history in the special .git directory +mentioned earlier so that our filesystem doesn’t become cluttered (and +so that we can’t accidentally edit or delete an old version).

+
+
+
+

Now suppose Dracula adds more information to the file. (Again, we’ll +edit with nano and then cat the file to show +its contents; you may use a different editor, and don’t need to +cat.)

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+
+

When we run git status now, it tells us that a file it +already knows about has been modified:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

The last line is the key phrase: “no changes added to commit”. We +have changed this file, but we haven’t told Git we will want to save +those changes (which we do with git add) nor have we saved +them (which we do with git commit). So let’s do that now. +It is good practice to always review our changes before saving them. We +do this using git diff. This shows us the differences +between the current state of the file and the most recently saved +version:

+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index df0654a..315bf3a 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1 +1,2 @@
+ Cold and dry, but everything is my favorite color
++The two moons may be a problem for Wolfman
+
+

The output is cryptic because it is actually a series of commands for +tools like editors and patch telling them how to +reconstruct one file given the other. If we break it down into +pieces:

+
  1. The first line tells us that Git is producing output similar to the +Unix diff command comparing the old and new versions of the +file.
  2. +
  3. The second line tells exactly which versions of the file Git is +comparing; df0654a and 315bf3a are unique +computer-generated labels for those versions.
  4. +
  5. The third and fourth lines once again show the name of the file +being changed.
  6. +
  7. The remaining lines are the most interesting, they show us the +actual differences and the lines on which they occur. In particular, the ++ marker in the first column shows where we added a +line.
  8. +

After reviewing our change, it’s time to commit it:

+
+

BASH +

+
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

Whoops: Git won’t commit because we didn’t use git add +first. Let’s fix that:

+
+

BASH +

+
$ git add mars.txt
+$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
[main 34961b1] Add concerns about effects of Mars' moons on Wolfman
+ 1 file changed, 1 insertion(+)
+
+

Git insists that we add files to the set we want to commit before +actually committing anything. This allows us to commit our changes in +stages and capture changes in logical portions rather than only large +batches. For example, suppose we’re adding a few citations to relevant +research to our thesis. We might want to commit those additions, and the +corresponding bibliography entries, but not commit some of our +work drafting the conclusion (which we haven’t finished yet).

+

To allow for this, Git has a special staging area where it +keeps track of things that have been added to the current changeset but not yet committed.

+
+
+ +
+
+

Staging Area +

+
+

If you think of Git as taking snapshots of changes over the life of a +project, git add specifies what will go in a +snapshot (putting things in the staging area), and +git commit then actually takes the snapshot, and +makes a permanent record of it (as a commit). If you don’t have anything +staged when you type git commit, Git will prompt you to use +git commit -a or git commit --all, which is +kind of like gathering everyone to take a group photo! However, +it’s almost always better to explicitly add things to the staging area, +because you might commit changes you forgot you made. (Going back to the +group photo simile, you might get an extra with incomplete makeup +walking on the stage for the picture because you used +-a!).

+

In the context of creating official statistics, using +--all or -a can lead to files being staged and +committed that should not be released (like microdata) or can cause +difficulties for others on the project (like environment files).

+

Staging things manually or using a pattern is the best practice, +otherwise you might find yourself searching for “git undo commit” more +than you would like!

+

Remember to use git status after you add files to check +what you have staged/added.

+
+
+
+
The Git Staging Area

Let’s watch as our changes to a file move from our editor to the +staging area and into long-term storage. First, we’ll add another line +to the file:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+But the Mummy will appreciate the lack of humidity
+
+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

So far, so good: we’ve added one line to the end of the file (shown +with a + in the first column). Now let’s put that change in +the staging area and see what git diff reports:

+
+

BASH +

+
$ git add mars.txt
+$ git diff
+
+

There is no output: as far as Git can tell, there’s no difference +between what it’s been asked to save permanently and what’s currently in +the directory. However, if we do this:

+
+

BASH +

+
$ git diff --staged
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

it shows us the difference between the last committed change and +what’s in the staging area. Let’s save our changes:

+
+

BASH +

+
$ git commit -m "Discuss concerns about Mars' climate for Mummy"
+
+
+

OUTPUT +

+
[main 005937f] Discuss concerns about Mars' climate for Mummy
+ 1 file changed, 1 insertion(+)
+
+

check our status:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

and look at the history of what we’ve done so far:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+    Discuss concerns about Mars' climate for Mummy
+
+commit 34961b159c27df3b475cfe4415d94a6d1fcd064d
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:07:21 2013 -0400
+
+    Add concerns about effects of Mars' moons on Wolfman
+
+commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+
+
+ +
+
+

Word-based diffing +

+
+

Sometimes, e.g. in the case of the text documents a line-wise diff is +too coarse. That is where the --color-words option of +git diff comes in very useful as it highlights the changed +words using colors.

+
+
+
+
+
+ +
+
+

Paging the Log +

+
+

When the output of git log is too long to fit in your +screen, git uses a program to split it into pages of the +size of your screen. When this “pager” is called, you will notice that +the last line in your screen is a :, instead of your usual +prompt.

+
  • To get out of the pager, press Q.
  • +
  • To move to the next page, press Spacebar.
  • +
  • To search for some_word in all pages, press +/ and type some_word. Navigate through matches +pressing N.
  • +
+
+
+
+
+ +
+
+

Limit Log Size +

+
+

To avoid having git log cover your entire terminal +screen, you can limit the number of commits that Git lists by using +-N, where N is the number of commits that you +want to view. For example, if you only want information from the last +commit you can use:

+
+

BASH +

+
$ git log -1
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+   Discuss concerns about Mars' climate for Mummy
+
+

You can also reduce the quantity of information using the +--oneline option:

+
+

BASH +

+
$ git log --oneline
+
+
+

OUTPUT +

+
005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+34961b1 Add concerns about effects of Mars' moons on Wolfman
+f22b25e Start notes on Mars as a base
+
+

You can also combine the --oneline option with others. +One useful combination adds --graph to display the commit +history as a text-based graph and to indicate which commits are +associated with the current HEAD, the current branch +main, or [other Git references][git-references]:

+
+

BASH +

+
$ git log --oneline --graph
+
+
+

OUTPUT +

+
* 005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+* 34961b1 Add concerns about effects of Mars' moons on Wolfman
+* f22b25e Start notes on Mars as a base
+
+
+
+
+
+
+ +
+
+

Directories +

+
+

Two important facts you should know about directories in Git.

+
  1. Git does not track directories on their own, only files within them. +Try it for yourself:
  2. +
+

BASH +

+
$ mkdir spaceships
+$ git status
+$ git add spaceships
+$ git status
+
+

Note, our newly created empty directory spaceships does +not appear in the list of untracked files even if we explicitly add it +(via git add) to our repository. This is the +reason why you will sometimes see .gitkeep files in +otherwise empty directories. Unlike .gitignore, these files +are not special and their sole purpose is to populate a directory so +that Git adds it to the repository. In fact, you can name such files +anything you like.

+
  1. If you create a directory in your Git repository and populate it +with files, you can add all files in the directory at once by:
  2. +
+

BASH +

+
git add <directory-with-files>
+
+

Try it for yourself:

+
+

BASH +

+
$ touch spaceships/apollo-11 spaceships/sputnik-1
+$ git status
+$ git add spaceships
+$ git status
+
+

Before moving on, we will commit these changes.

+
+

BASH +

+
$ git commit -m "Add some initial thoughts on spaceships"
+
+
+
+
+

To recap, when we want to add changes to our repository, we first +need to add the changed files to the staging area (git add) +and then commit the staged changes to the repository +(git commit):

+
The Git Commit Workflow
+
+ +
+
+

Choosing a Commit Message +

+
+

Which of the following commit messages would be most appropriate for +the last commit made to mars.txt?

+
  1. “Changes”
  2. +
  3. “Added line ‘But the Mummy will appreciate the lack of humidity’ to +mars.txt”
  4. +
  5. “Discuss effects of Mars’ climate on the Mummy”
  6. +
+
+
+
+
+ +
+
+

Answer 1 is not descriptive enough, and the purpose of the commit is +unclear; and answer 2 is redundant to using “git diff” to see what +changed in this commit; but answer 3 is good: short, descriptive, and +imperative.

+
+
+
+
+
+
+ +
+
+

Committing Changes to Git +

+
+

Which command(s) below would save the changes of +myfile.txt to my local Git repository?

+
  1. +

    BASH +

    +
      $ git commit -m "my recent changes"
    +
  2. +
  3. +

    BASH +

    +
      $ git init myfile.txt
    +  $ git commit -m "my recent changes"
    +
  4. +
  5. +

    BASH +

    +
      $ git add myfile.txt
    +  $ git commit -m "my recent changes"
    +
  6. +
  7. +

    BASH +

    +
      $ git commit -m myfile.txt "my recent changes"
    +
  8. +
+
+
+
+
+ +
+
+
  1. Would only create a commit if files have already been staged.
  2. +
  3. Would try to create a new repository.
  4. +
  5. Is correct: first add the file to the staging area, then +commit.
  6. +
  7. Would try to commit a file “my recent changes” with the message +myfile.txt.
  8. +
+
+
+
+
+
+ +
+
+

Committing Multiple Files +

+
+

The staging area can hold changes from any number of files that you +want to commit as a single snapshot.

+
  1. Add some text to mars.txt noting your decision to +consider Venus as a base
  2. +
  3. Create a new file venus.txt with your initial thoughts +about Venus as a base for you and your friends
  4. +
  5. Add changes from both files to the staging area, and commit those +changes.
  6. +
+
+
+
+
+ +
+
+

The output below from cat mars.txt reflects only content +added during this exercise. Your output may vary.

+

First we make our changes to the mars.txt and +venus.txt files:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Maybe I should start with a base on Venus.
+
+
+

BASH +

+
$ nano venus.txt
+$ cat venus.txt
+
+
+

OUTPUT +

+
Venus is a nice planet and I definitely should consider it as a base.
+
+

Now you can add both files to the staging area. We can do that in one +line:

+
+

BASH +

+
$ git add mars.txt venus.txt
+
+

Or with multiple commands:

+
+

BASH +

+
$ git add mars.txt
+$ git add venus.txt
+
+

Now the files are ready to commit. You can check that using +git status. If you are ready to commit use:

+
+

BASH +

+
$ git commit -m "Write plans to start a base on Venus"
+
+
+

OUTPUT +

+
[main cc127c2]
+ Write plans to start a base on Venus
+ 2 files changed, 2 insertions(+)
+ create mode 100644 venus.txt
+
+
+
+
+
+
+
+ +
+
+

+bio Repository +

+
+
  • Create a new Git repository on your computer called +bio.
  • +
  • Write a three-line biography for yourself in a file called +me.txt, commit your changes
  • +
  • Modify one line, add a fourth line
  • +
  • Display the differences between its updated state and its original +state.
  • +
+
+
+
+
+ +
+
+

If needed, move out of the planets folder:

+
+

BASH +

+
$ cd ..
+
+

Create a new folder called bio and ‘move’ into it:

+
+

BASH +

+
$ mkdir bio
+$ cd bio
+
+

Initialise git:

+
+

BASH +

+
$ git init
+
+

Create your biography file me.txt using +nano or another text editor. Once in place, add and commit +it to the repository:

+
+

BASH +

+
$ git add me.txt
+$ git commit -m "Add biography file" 
+
+

Modify the file as described (modify one line, add a fourth line). To +display the differences between its updated state and its original +state, use git diff:

+
+

BASH +

+
$ git diff me.txt
+
+
+
+
+
+
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/06-exploring_history.html b/06-exploring_history.html new file mode 100644 index 0000000..428c7d6 --- /dev/null +++ b/06-exploring_history.html @@ -0,0 +1,518 @@ + +Git for Official Statistics: Exploring History +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Exploring History

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I identify old versions of files?
  • +
  • How do I review my changes?
  • +
  • How can I recover old versions of files?
  • +
+
+
+
+
+
+

Objectives

+
  • view commit history of a file
  • +
  • checkout an older version of a file
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/07-ignoring_things.html b/07-ignoring_things.html new file mode 100644 index 0000000..a3ce36e --- /dev/null +++ b/07-ignoring_things.html @@ -0,0 +1,517 @@ + +Git for Official Statistics: Ignoring Things +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Ignoring Things

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I tell Git to ignore files I don’t want to track?
  • +
  • What do we have to watch for when creating official statistics?
  • +
+
+
+
+
+
+

Objectives

+
  • create a .gitignore
  • +
  • identify file types and areas of risk for official statistics
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/08-remotes.html b/08-remotes.html new file mode 100644 index 0000000..173c3d5 --- /dev/null +++ b/08-remotes.html @@ -0,0 +1,515 @@ + +Git for Official Statistics: Remotes in GitLab/GitHub +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Remotes in GitLab/GitHub

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I share my changes with others on the web?
  • +
+
+
+
+
+
+

Objectives

+
  • Connect Git to a remote repository
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/09-collaborating.html b/09-collaborating.html new file mode 100644 index 0000000..d803f63 --- /dev/null +++ b/09-collaborating.html @@ -0,0 +1,515 @@ + +Git for Official Statistics: Collaborating +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Collaborating

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I use version control to collaborate with other people?
  • +
+
+
+
+
+
+

Objectives

+
  • Use Git and branches to work with others locally
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/10-conflicts.html b/10-conflicts.html new file mode 100644 index 0000000..c678de7 --- /dev/null +++ b/10-conflicts.html @@ -0,0 +1,515 @@ + +Git for Official Statistics: Conflicts +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Conflicts

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • What do I do when my changes conflict with someone else’s?
  • +
+
+
+
+
+
+

Objectives

+
  • Resolve a merge conflict
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/11-working_remotes.html b/11-working_remotes.html new file mode 100644 index 0000000..2e63821 --- /dev/null +++ b/11-working_remotes.html @@ -0,0 +1,518 @@ + +Git for Official Statistics: Working with Others in GitHub/GitLab +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Working with Others in GitHub/GitLab

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I put work on the protected branch?
  • +
  • How can we keep track of what needs to be done?
  • +
  • How can I add collaborators?
  • +
+
+
+
+
+
+

Objectives

+
  • Add collaborators to a remote repository
  • +
  • use issues to keep track of project needs
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/12-documentation.html b/12-documentation.html new file mode 100644 index 0000000..40568d5 --- /dev/null +++ b/12-documentation.html @@ -0,0 +1,518 @@ + +Git for Official Statistics: Documenting in GitHub/GitLab for official statistics +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Documenting in GitHub/GitLab for official statistics

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I create documentation so others can understand my +methodology?
  • +
  • How can I host it easily on GitHub?
  • +
+
+
+
+
+
+

Objectives

+
  • Create documentation using markdown
  • +
  • add links and images to documentation
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/13-citation.html b/13-citation.html new file mode 100644 index 0000000..9136240 --- /dev/null +++ b/13-citation.html @@ -0,0 +1,515 @@ + +Git for Official Statistics: Citation +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Citation

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I make my work easier to cite?
  • +
+
+
+
+
+
+

Objectives

+
  • How to cite and be cited
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/404.html b/404.html new file mode 100644 index 0000000..ea010ff --- /dev/null +++ b/404.html @@ -0,0 +1,478 @@ + +Git for Official Statistics: Page not found +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Page not found

+ +

Our apologies! +

+

We cannot seem to find the page you are looking for. Here are some +tips that may help:

+
  1. try going back to the previous +page or
  2. +
  3. navigate to any other page using the navigation bar on the +left.
  4. +
  5. if the URL ends with /index.html, try removing +that.
  6. +
  7. head over to the home page of this +lesson +
  8. +

If you came here from a link in this lesson, please contact the +lesson maintainers using the links at the foot of this page.

+
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/CODE_OF_CONDUCT.html b/CODE_OF_CONDUCT.html new file mode 100644 index 0000000..8cbe311 --- /dev/null +++ b/CODE_OF_CONDUCT.html @@ -0,0 +1,483 @@ + +Git for Official Statistics: Contributor Code of Conduct +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Contributor Code of Conduct

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +

As contributors and maintainers of this project, we pledge to follow +the The +Carpentries Code of Conduct.

+

Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by following our reporting +guidelines.

+ + + +
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/LICENSE.html b/LICENSE.html new file mode 100644 index 0000000..6b5a6e3 --- /dev/null +++ b/LICENSE.html @@ -0,0 +1,534 @@ + +Git for Official Statistics: Licenses +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Licenses

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + + +

Instructional Material +

+

All Carpentries (Software Carpentry, Data Carpentry, and Library +Carpentry) instructional material is made available under the Creative Commons +Attribution license. The following is a human-readable summary of +(and not a substitute for) the full legal +text of the CC BY 4.0 license.

+

You are free:

+
  • to Share—copy and redistribute the material in any +medium or format
  • +
  • to Adapt—remix, transform, and build upon the +material
  • +

for any purpose, even commercially.

+

The licensor cannot revoke these freedoms as long as you follow the +license terms.

+

Under the following terms:

+
  • Attribution—You must give appropriate credit +(mentioning that your work is derived from work that is Copyright (c) +The Carpentries and, where practical, linking to https://carpentries.org/), provide a link to the +license, and indicate if changes were made. You may do so in any +reasonable manner, but not in any way that suggests the licensor +endorses you or your use.

  • +
  • No additional restrictions—You may not apply +legal terms or technological measures that legally restrict others from +doing anything the license permits. With the understanding +that:

  • +

Notices:

+
  • You do not have to comply with the license for elements of the +material in the public domain or where your use is permitted by an +applicable exception or limitation.
  • +
  • No warranties are given. The license may not give you all of the +permissions necessary for your intended use. For example, other rights +such as publicity, privacy, or moral rights may limit how you use the +material.
  • +

Software +

+

Except where otherwise noted, the example programs and other software +provided by The Carpentries are made available under the OSI-approved MIT +license.

+

Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +“Software”), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions:

+

The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+

Trademark +

+

“The Carpentries”, “Software Carpentry”, “Data Carpentry”, and +“Library Carpentry” and their respective logos are registered trademarks +of Community Initiatives.

+
+
+ + +
+
+
+ +
Back To Top +
+
+ + diff --git a/aio.html b/aio.html new file mode 100644 index 0000000..732fc62 --- /dev/null +++ b/aio.html @@ -0,0 +1,2285 @@ + + + + + +Git for Official Statistics: All in One View + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+ + +

Content from Introduction

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • Why use version control in official statistics?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Identify uses and purposes for using Git in official statistics
  • +
+
+
+
+
+
+

Version Control in General + +

+
+

Version control is important whether you are working alone or +collaboratively, even if you are not working in statistics!

+

Here’s the basics of how a version control system works:

+
    +
  • start with a base version of a document
  • +
  • record changes made each step of the way
  • +
  • collaborators can add changes in independently without conflict
  • +
+
Web comic about sending a file back and forth using the file name as version control

You’ve probably already seen a version control system.

+

Good version control systems will allow you to see the history of a +project and will sync across different computers, facilitating +collaboration.

+
+
+ +
+
+

Version Control Systems +

+
+

What version control systems have you likely already come across? +List 1-2

+
+
+
+
+
+ +
+
+

You’ve probably seen Microsoft’s Track Changes and Google Doc’s +version history

+
+
+
+
+

Why Version Controlling Matters in Official Statistics + +

+
+

There are a number of reasons why version control matters matters in +official statistics:

+
    +
  1. Reproducibility: Within and across organizations, we need to be +able to reproduce statistics. This could be to ensure consistency in +methodology across reference periods, or check to see if statistics are +comparable in their methodologies.

  2. +
  3. Standardization: We can use version control systems as a single +source of truth to create standardization of statistics between and +within organizations.

  4. +
  5. Disseminate changes and updated versions: Following our single +source of truth, we can easily update and share changes to calculations +of official statistics as well as any new documentation or +methodologies. This means we are updating in one place rather than +many.

  6. +
  7. Collaboration: Version control systems allow us to collaborate +and connect on the creation of official statistics internally and +externally with stakeholders. We can use these systems to share proposed +changes, share work, and test code.

  8. +
  9. Efficient and Effective Development of Code: With a single source +of truth, we know exactly where to propose and find changes code that +makes our statistics. In addition, many version control systems have +project management or feedback tools that we can leverage to bundle +communication and discussion with the code itself rather than working in +multiple systems. This can allow for faster feedback and proposed +updates.

  10. +

Content from Version Control

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • What is Git?
  • +
  • Why should I use it?
  • +
  • How does it relate to open statistics?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Identify key concepts in version control and its use in official +statistics
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Setting up Git

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I set up Git?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Configure basic settings in Git
  • +
+
+
+
+
+
+

Before we start using Git for the first time on a new computer, there +are some things we need to set up. In this lesson, we will:

+
    +
  • Add a name and email address
  • +
  • Set the text editor used for writing commit messages
  • +
  • Understand the difference between --global and +--local configuration
  • +
  • View/confirm configuration settings
  • +
+

We will be using Git Bash, the command line interface for Git.

+

Configure Name and Email + +

+
+

An important first step in using Git is adding your name and email. +This information will be attached to commits, +branches, +and other changes you make in the future. This identifiability and +accountability for code changes is one of the key benefits to using +Git.

+

At the Git Bash prompt, enter the following, substituting your full +name for the name in quotation marks after user.name and +your email for the email address following user.email.

+
+

BASH +

+
$ git config --global user.name "Jane Doe"
+$ git config --global user.email "doe_jane@agency.gov"
+
+

Your situation may vary, but if you are writing code in your official +capacity and using an agency repository, you will most likely want to +use your official email address and the one associated with your account +on GitHub, GitLab, or other code sharing site.

+

Configure Text Editor + +

+
+
+

This is optional. By default, Git Bash will use the Vim text +editor.

+
+

There are many different Git clients and ways of interacting with Git +on your computer. Some clients have a full user interface that you use +for selecting files to stage for commits and authoring commit messages. +Others, like Git Bash, have a command line interface so when you want to +write a lengthy commit message, it needs to call up a text editor.

+
+
+ +
+
+

Different Ways to Author Commit Messages +

+
+

As you will learn in a +later lesson, once you make updates to your code, you will want to +make a snapshot of those updates called a commit and provide an +informative message that describes what was changed. This message can be +short and be written on the command line (e.g., +git commit -m "Update README.md"). Sometimes however, you +will want to write a longer, multi-line commit message. You can do this +by entering git commit on the command line. This will bring +up the text editor you have configured as your default.

+
+
+
+

The default text editor for Git Bash is Vim which has a reputation +for being difficult, especially for new users. So you may want to change +to something easier to use or something you are more familiar with +(e.g., your favorite text editor).

+

To switch to one of the following editors in the tables below, you +can use the associated configuration commands.

+

The nano text editor is packaged with Git Bash and Notepad is +included in the Windows operating system.

+ ++++ + + + + + + + + + + + + + + +
EditorConfiguration command
nano$ git config --global core.editor "nano -w"
Notepad (Win)$ git config --global core.editor "c:/Windows/System32/notepad.exe"
+

The text editors below are not available by default, but you may be +available to you. Setup for these is more complex because it requires +providing a filepath to the program executable which may not be the same +for everyone.

+ ++++ + + + + + + + + + + + + + + + + + + +
EditorConfiguration command
Notepad++ (Win, 64-bit install)$ git config --global core.editor "'c:/program files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Sublime Text (Win, 64-bit install)$ git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
VS Code$ git config --global core.editor "code --wait"
+

If you ever want to switch back to Vim as the default, you can run +the following command.

+ ++++ + + + + + + + + +
EditorConfiguration command
Vim$ git config --global core.editor "vim"
+
+
+ +
+
+

Exiting Vim +

+
+

Vim is surprisingly difficult to exit from. If you wish to exit a +session without saving your changes, press Esc then type +:q! and hit Enter or . If you want +to save your changes and quit, press Esc then type +:wq and hit Enter or .

+
+
+
+

+--global vs. --local + +

+
+

In the code samples above, we have used the --global +flag. These are the settings Git will use for all repositories on your +computer. As your use of Git becomes more complex, you may wish to have +different configuration settings for different repositories. This is +when you might use the --local flag. --local +allows you to set configuration for specific repositories.

+

To set local configuration, open Git Bash and navigate to the +repository you want to configure. You can then use the commands above, +but substitute --local for --global.

+

For example, if you want to set a different name or email address for +a specific project, you can do so with commands like those below.

+
+

BASH +

+
$ git config --local user.name "Jane R Doe"
+$ git config --local user.email "janedoe@example.com"
+
+

These settings will override the --global configuration +settings for that repository only.

+

View/Confirm Configuration + +

+
+

You may wish to check your configuration settings.

+

To see all configuration settings, you can use the following command. +If you are in a repository, this will show all global and local +configuration settings.

+
+

BASH +

+
$ git config --list
+
+

To view global settings only (Note: This command can be run +anywhere):

+
+

BASH +

+
$ git config --global --list
+
+

To view local settings only (Note: This has to be run while +in a repository):

+
+

BASH +

+
$ git config --local --list
+
+

To view specific settings, include the setting name. For example, to +view the email address configuration setting:

+
+

BASH +

+
$ git config user.email 
+
+

Other Configuration Settings + +

+
+

There are other, optional configuration settings you may wish to +change. Review Git documentation and consult with others on your team +about other settings.

+
+
+ +
+
+

Key Points +

+
+
    +
  • Use git config with the --global option to +configure a user name, email address, editor, and other preferences once +per machine.
  • +
  • Use --local in place of --global within a +repository to set repository specific changes.
  • +
+
+
+
+

Content from Creating a Repository

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • Where does Git store information?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Create a repository in a local folder
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Tracking Changes

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I record changes in Git?
  • +
  • How do I check the status of my version control repository?
  • +
  • How do I record notes about what changes I made and why?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Check the history of a file
  • +
  • Use add and commit to record changes
  • +
  • Create commit messages that are descriptive
  • +
+
+
+
+
+
+

Note This lesson has been adapted from Lesson 4 +of Version Control with Git

+

Getting Started + +

+
+

First let’s make sure we’re still in the right directory. You should +be in the planets directory.

+
+

BASH +

+
$ cd ~/Desktop/planets
+
+

Let’s create a file called mars.txt that contains some +notes about the Red Planet’s suitability as a base. We’ll use +nano to edit the file; you can use whatever editor you +like. In particular, this does not have to be the +core.editor you set globally earlier. But remember, the +bash command to create or edit a new file will depend on the editor you +choose (it might not be nano). For a refresher on text +editors, check out “Which +Editor?” in The Unix Shell +lesson.

+
+

BASH +

+
$ nano mars.txt
+
+

Type the text below into the mars.txt file:

+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

Let’s first verify that the file was properly created by running the +list command (ls):

+
+

BASH +

+
$ ls
+
+
+

OUTPUT +

+
mars.txt
+
+

mars.txt contains a single line, which we can see by +running:

+
+

BASH +

+
$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

If we check the status of our project again, Git tells us that it’s +noticed the new file:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Untracked files:
+   (use "git add <file>..." to include in what will be committed)
+
+	mars.txt
+
+nothing added to commit but untracked files present (use "git add" to track)
+
+

The “untracked files” message means that there’s a file in the +directory that Git isn’t keeping track of. We can tell Git to track a +file using git add:

+
+

BASH +

+
$ git add mars.txt
+
+

and then check that the right thing happened:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Changes to be committed:
+  (use "git rm --cached <file>..." to unstage)
+
+	new file:   mars.txt
+
+
+

Git now knows that it’s supposed to keep track of +mars.txt, but it hasn’t recorded these changes as a commit +yet. To get it to do that, we need to run one more command:

+
+

BASH +

+
$ git commit -m "Start notes on Mars as a base"
+
+
+

OUTPUT +

+
[main (root-commit) f22b25e] Start notes on Mars as a base
+ 1 file changed, 1 insertion(+)
+ create mode 100644 mars.txt
+
+

When we run git commit, Git takes everything we have +told it to save by using git add and stores a copy +permanently inside the special .git directory. This +permanent copy is called a commit +(or revision) and its short +identifier is f22b25e. Your commit may have another +identifier.

+

We use the -m flag (for “message”) to record a short, +descriptive, and specific comment that will help us remember later on +what we did and why. If we just run git commit without the +-m option, Git will launch nano (or whatever +other editor we configured as core.editor) so that we can +write a longer message.

+

[Good commit messages][commit-messages] start with a brief (<50 +characters) statement about the changes made in the commit. Generally, +the message should complete the sentence “If applied, this commit will” +. If you want to go into more detail, add a blank +line between the summary line and your additional notes. Use this +additional space to explain why you made changes and/or what their +impact will be.

+

If we run git status now:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

it tells us everything is up to date. If we want to know what we’ve +done recently, we can ask Git to show us the project’s history using +git log:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+

git log lists all commits made to a repository in +reverse chronological order. The listing for each commit includes the +commit’s full identifier (which starts with the same characters as the +short identifier printed by the git commit command +earlier), the commit’s author, when it was created, and the log message +Git was given when the commit was created.

+
+
+ +
+
+

Where Are My Changes? +

+
+

If we run ls at this point, we will still see just one +file called mars.txt. That’s because Git saves information +about files’ history in the special .git directory +mentioned earlier so that our filesystem doesn’t become cluttered (and +so that we can’t accidentally edit or delete an old version).

+
+
+
+

Now suppose Dracula adds more information to the file. (Again, we’ll +edit with nano and then cat the file to show +its contents; you may use a different editor, and don’t need to +cat.)

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+
+

When we run git status now, it tells us that a file it +already knows about has been modified:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

The last line is the key phrase: “no changes added to commit”. We +have changed this file, but we haven’t told Git we will want to save +those changes (which we do with git add) nor have we saved +them (which we do with git commit). So let’s do that now. +It is good practice to always review our changes before saving them. We +do this using git diff. This shows us the differences +between the current state of the file and the most recently saved +version:

+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index df0654a..315bf3a 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1 +1,2 @@
+ Cold and dry, but everything is my favorite color
++The two moons may be a problem for Wolfman
+
+

The output is cryptic because it is actually a series of commands for +tools like editors and patch telling them how to +reconstruct one file given the other. If we break it down into +pieces:

+
    +
  1. The first line tells us that Git is producing output similar to the +Unix diff command comparing the old and new versions of the +file.
  2. +
  3. The second line tells exactly which versions of the file Git is +comparing; df0654a and 315bf3a are unique +computer-generated labels for those versions.
  4. +
  5. The third and fourth lines once again show the name of the file +being changed.
  6. +
  7. The remaining lines are the most interesting, they show us the +actual differences and the lines on which they occur. In particular, the ++ marker in the first column shows where we added a +line.
  8. +
+

After reviewing our change, it’s time to commit it:

+
+

BASH +

+
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

Whoops: Git won’t commit because we didn’t use git add +first. Let’s fix that:

+
+

BASH +

+
$ git add mars.txt
+$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
[main 34961b1] Add concerns about effects of Mars' moons on Wolfman
+ 1 file changed, 1 insertion(+)
+
+

Git insists that we add files to the set we want to commit before +actually committing anything. This allows us to commit our changes in +stages and capture changes in logical portions rather than only large +batches. For example, suppose we’re adding a few citations to relevant +research to our thesis. We might want to commit those additions, and the +corresponding bibliography entries, but not commit some of our +work drafting the conclusion (which we haven’t finished yet).

+

To allow for this, Git has a special staging area where it +keeps track of things that have been added to the current changeset but not yet committed.

+
+
+ +
+
+

Staging Area +

+
+

If you think of Git as taking snapshots of changes over the life of a +project, git add specifies what will go in a +snapshot (putting things in the staging area), and +git commit then actually takes the snapshot, and +makes a permanent record of it (as a commit). If you don’t have anything +staged when you type git commit, Git will prompt you to use +git commit -a or git commit --all, which is +kind of like gathering everyone to take a group photo! However, +it’s almost always better to explicitly add things to the staging area, +because you might commit changes you forgot you made. (Going back to the +group photo simile, you might get an extra with incomplete makeup +walking on the stage for the picture because you used +-a!).

+

In the context of creating official statistics, using +--all or -a can lead to files being staged and +committed that should not be released (like microdata) or can cause +difficulties for others on the project (like environment files).

+

Staging things manually or using a pattern is the best practice, +otherwise you might find yourself searching for “git undo commit” more +than you would like!

+

Remember to use git status after you add files to check +what you have staged/added.

+
+
+
+
The Git Staging Area

Let’s watch as our changes to a file move from our editor to the +staging area and into long-term storage. First, we’ll add another line +to the file:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+But the Mummy will appreciate the lack of humidity
+
+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

So far, so good: we’ve added one line to the end of the file (shown +with a + in the first column). Now let’s put that change in +the staging area and see what git diff reports:

+
+

BASH +

+
$ git add mars.txt
+$ git diff
+
+

There is no output: as far as Git can tell, there’s no difference +between what it’s been asked to save permanently and what’s currently in +the directory. However, if we do this:

+
+

BASH +

+
$ git diff --staged
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

it shows us the difference between the last committed change and +what’s in the staging area. Let’s save our changes:

+
+

BASH +

+
$ git commit -m "Discuss concerns about Mars' climate for Mummy"
+
+
+

OUTPUT +

+
[main 005937f] Discuss concerns about Mars' climate for Mummy
+ 1 file changed, 1 insertion(+)
+
+

check our status:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

and look at the history of what we’ve done so far:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+    Discuss concerns about Mars' climate for Mummy
+
+commit 34961b159c27df3b475cfe4415d94a6d1fcd064d
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:07:21 2013 -0400
+
+    Add concerns about effects of Mars' moons on Wolfman
+
+commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+
+
+ +
+
+

Word-based diffing +

+
+

Sometimes, e.g. in the case of the text documents a line-wise diff is +too coarse. That is where the --color-words option of +git diff comes in very useful as it highlights the changed +words using colors.

+
+
+
+
+
+ +
+
+

Paging the Log +

+
+

When the output of git log is too long to fit in your +screen, git uses a program to split it into pages of the +size of your screen. When this “pager” is called, you will notice that +the last line in your screen is a :, instead of your usual +prompt.

+
    +
  • To get out of the pager, press Q.
  • +
  • To move to the next page, press Spacebar.
  • +
  • To search for some_word in all pages, press +/ and type some_word. Navigate through matches +pressing N.
  • +
+
+
+
+
+
+ +
+
+

Limit Log Size +

+
+

To avoid having git log cover your entire terminal +screen, you can limit the number of commits that Git lists by using +-N, where N is the number of commits that you +want to view. For example, if you only want information from the last +commit you can use:

+
+

BASH +

+
$ git log -1
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+   Discuss concerns about Mars' climate for Mummy
+
+

You can also reduce the quantity of information using the +--oneline option:

+
+

BASH +

+
$ git log --oneline
+
+
+

OUTPUT +

+
005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+34961b1 Add concerns about effects of Mars' moons on Wolfman
+f22b25e Start notes on Mars as a base
+
+

You can also combine the --oneline option with others. +One useful combination adds --graph to display the commit +history as a text-based graph and to indicate which commits are +associated with the current HEAD, the current branch +main, or [other Git references][git-references]:

+
+

BASH +

+
$ git log --oneline --graph
+
+
+

OUTPUT +

+
* 005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+* 34961b1 Add concerns about effects of Mars' moons on Wolfman
+* f22b25e Start notes on Mars as a base
+
+
+
+
+
+
+ +
+
+

Directories +

+
+

Two important facts you should know about directories in Git.

+
    +
  1. Git does not track directories on their own, only files within them. +Try it for yourself:
  2. +
+
+

BASH +

+
$ mkdir spaceships
+$ git status
+$ git add spaceships
+$ git status
+
+

Note, our newly created empty directory spaceships does +not appear in the list of untracked files even if we explicitly add it +(via git add) to our repository. This is the +reason why you will sometimes see .gitkeep files in +otherwise empty directories. Unlike .gitignore, these files +are not special and their sole purpose is to populate a directory so +that Git adds it to the repository. In fact, you can name such files +anything you like.

+
    +
  1. If you create a directory in your Git repository and populate it +with files, you can add all files in the directory at once by:
  2. +
+
+

BASH +

+
git add <directory-with-files>
+
+

Try it for yourself:

+
+

BASH +

+
$ touch spaceships/apollo-11 spaceships/sputnik-1
+$ git status
+$ git add spaceships
+$ git status
+
+

Before moving on, we will commit these changes.

+
+

BASH +

+
$ git commit -m "Add some initial thoughts on spaceships"
+
+
+
+
+

To recap, when we want to add changes to our repository, we first +need to add the changed files to the staging area (git add) +and then commit the staged changes to the repository +(git commit):

+
The Git Commit Workflow
+
+ +
+
+

Choosing a Commit Message +

+
+

Which of the following commit messages would be most appropriate for +the last commit made to mars.txt?

+
    +
  1. “Changes”
  2. +
  3. “Added line ‘But the Mummy will appreciate the lack of humidity’ to +mars.txt”
  4. +
  5. “Discuss effects of Mars’ climate on the Mummy”
  6. +
+
+
+
+
+
+ +
+
+

Answer 1 is not descriptive enough, and the purpose of the commit is +unclear; and answer 2 is redundant to using “git diff” to see what +changed in this commit; but answer 3 is good: short, descriptive, and +imperative.

+
+
+
+
+
+
+ +
+
+

Committing Changes to Git +

+
+

Which command(s) below would save the changes of +myfile.txt to my local Git repository?

+
    +
  1. +

    BASH +

    +
      $ git commit -m "my recent changes"
    +
  2. +
  3. +

    BASH +

    +
      $ git init myfile.txt
    +  $ git commit -m "my recent changes"
    +
  4. +
  5. +

    BASH +

    +
      $ git add myfile.txt
    +  $ git commit -m "my recent changes"
    +
  6. +
  7. +

    BASH +

    +
      $ git commit -m myfile.txt "my recent changes"
    +
  8. +
+
+
+
+
+
+ +
+
+
    +
  1. Would only create a commit if files have already been staged.
  2. +
  3. Would try to create a new repository.
  4. +
  5. Is correct: first add the file to the staging area, then +commit.
  6. +
  7. Would try to commit a file “my recent changes” with the message +myfile.txt.
  8. +
+
+
+
+
+
+
+ +
+
+

Committing Multiple Files +

+
+

The staging area can hold changes from any number of files that you +want to commit as a single snapshot.

+
    +
  1. Add some text to mars.txt noting your decision to +consider Venus as a base
  2. +
  3. Create a new file venus.txt with your initial thoughts +about Venus as a base for you and your friends
  4. +
  5. Add changes from both files to the staging area, and commit those +changes.
  6. +
+
+
+
+
+
+ +
+
+

The output below from cat mars.txt reflects only content +added during this exercise. Your output may vary.

+

First we make our changes to the mars.txt and +venus.txt files:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Maybe I should start with a base on Venus.
+
+
+

BASH +

+
$ nano venus.txt
+$ cat venus.txt
+
+
+

OUTPUT +

+
Venus is a nice planet and I definitely should consider it as a base.
+
+

Now you can add both files to the staging area. We can do that in one +line:

+
+

BASH +

+
$ git add mars.txt venus.txt
+
+

Or with multiple commands:

+
+

BASH +

+
$ git add mars.txt
+$ git add venus.txt
+
+

Now the files are ready to commit. You can check that using +git status. If you are ready to commit use:

+
+

BASH +

+
$ git commit -m "Write plans to start a base on Venus"
+
+
+

OUTPUT +

+
[main cc127c2]
+ Write plans to start a base on Venus
+ 2 files changed, 2 insertions(+)
+ create mode 100644 venus.txt
+
+
+
+
+
+
+
+ +
+
+

+bio Repository +

+
+
    +
  • Create a new Git repository on your computer called +bio.
  • +
  • Write a three-line biography for yourself in a file called +me.txt, commit your changes
  • +
  • Modify one line, add a fourth line
  • +
  • Display the differences between its updated state and its original +state.
  • +
+
+
+
+
+
+ +
+
+

If needed, move out of the planets folder:

+
+

BASH +

+
$ cd ..
+
+

Create a new folder called bio and ‘move’ into it:

+
+

BASH +

+
$ mkdir bio
+$ cd bio
+
+

Initialise git:

+
+

BASH +

+
$ git init
+
+

Create your biography file me.txt using +nano or another text editor. Once in place, add and commit +it to the repository:

+
+

BASH +

+
$ git add me.txt
+$ git commit -m "Add biography file" 
+
+

Modify the file as described (modify one line, add a fourth line). To +display the differences between its updated state and its original +state, use git diff:

+
+

BASH +

+
$ git diff me.txt
+
+
+
+
+
+

Content from Exploring History

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I identify old versions of files?
  • +
  • How do I review my changes?
  • +
  • How can I recover old versions of files?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • view commit history of a file
  • +
  • checkout an older version of a file
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Ignoring Things

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I tell Git to ignore files I don’t want to track?
  • +
  • What do we have to watch for when creating official statistics?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • create a .gitignore
  • +
  • identify file types and areas of risk for official statistics
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Remotes in GitLab/GitHub

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I share my changes with others on the web?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Connect Git to a remote repository
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Collaborating

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I use version control to collaborate with other people?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Use Git and branches to work with others locally
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Conflicts

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • What do I do when my changes conflict with someone else’s?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Resolve a merge conflict
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Working with Others in GitHub/GitLab

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I put work on the protected branch?
  • +
  • How can we keep track of what needs to be done?
  • +
  • How can I add collaborators?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Add collaborators to a remote repository
  • +
  • use issues to keep track of project needs
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Documenting in GitHub/GitLab for official statistics

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I create documentation so others can understand my +methodology?
  • +
  • How can I host it easily on GitHub?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Create documentation using markdown
  • +
  • add links and images to documentation
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Citation

+
+

Last updated on 2024-07-11 | + + Edit this page

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I make my work easier to cite?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • How to cite and be cited
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+
+
+
+
+ + +
+ + +
+
+ +
Back To Top +
+
+ + + + diff --git a/android-chrome-192x192.png b/android-chrome-192x192.png new file mode 100644 index 0000000..ed3c210 Binary files /dev/null and b/android-chrome-192x192.png differ diff --git a/android-chrome-512x512.png b/android-chrome-512x512.png new file mode 100644 index 0000000..c88d96c Binary files /dev/null and b/android-chrome-512x512.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png new file mode 100644 index 0000000..8044fee Binary files /dev/null and b/apple-touch-icon.png differ diff --git a/assets/fonts/Mulish-Bold.ttf b/assets/fonts/Mulish-Bold.ttf new file mode 100644 index 0000000..1f522d4 Binary files /dev/null and b/assets/fonts/Mulish-Bold.ttf differ diff --git a/assets/fonts/Mulish-Bold.woff b/assets/fonts/Mulish-Bold.woff new file mode 100644 index 0000000..711448e Binary files /dev/null and b/assets/fonts/Mulish-Bold.woff differ diff --git a/assets/fonts/Mulish-ExtraBold.ttf b/assets/fonts/Mulish-ExtraBold.ttf new file mode 100644 index 0000000..62850ff Binary files /dev/null and b/assets/fonts/Mulish-ExtraBold.ttf differ diff --git a/assets/fonts/mulish-v5-latin-regular.eot b/assets/fonts/mulish-v5-latin-regular.eot new file mode 100644 index 0000000..423bcb1 Binary files /dev/null and b/assets/fonts/mulish-v5-latin-regular.eot differ diff --git a/assets/fonts/mulish-v5-latin-regular.svg b/assets/fonts/mulish-v5-latin-regular.svg new file mode 100644 index 0000000..70341f9 --- /dev/null +++ b/assets/fonts/mulish-v5-latin-regular.svg @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/fonts/mulish-v5-latin-regular.ttf b/assets/fonts/mulish-v5-latin-regular.ttf new file mode 100644 index 0000000..541bb40 Binary files /dev/null and b/assets/fonts/mulish-v5-latin-regular.ttf differ diff --git a/assets/fonts/mulish-v5-latin-regular.woff b/assets/fonts/mulish-v5-latin-regular.woff new file mode 100644 index 0000000..700ec13 Binary files /dev/null and b/assets/fonts/mulish-v5-latin-regular.woff differ diff --git a/assets/fonts/mulish-v5-latin-regular.woff2 b/assets/fonts/mulish-v5-latin-regular.woff2 new file mode 100644 index 0000000..b244298 Binary files /dev/null and b/assets/fonts/mulish-v5-latin-regular.woff2 differ diff --git a/assets/fonts/mulish-variablefont_wght.woff b/assets/fonts/mulish-variablefont_wght.woff new file mode 100644 index 0000000..fc42538 Binary files /dev/null and b/assets/fonts/mulish-variablefont_wght.woff differ diff --git a/assets/fonts/mulish-variablefont_wght.woff2 b/assets/fonts/mulish-variablefont_wght.woff2 new file mode 100644 index 0000000..8a233c6 Binary files /dev/null and b/assets/fonts/mulish-variablefont_wght.woff2 differ diff --git a/assets/images/carpentries-logo-sm.svg b/assets/images/carpentries-logo-sm.svg new file mode 100644 index 0000000..da70d40 --- /dev/null +++ b/assets/images/carpentries-logo-sm.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/assets/images/carpentries-logo.svg b/assets/images/carpentries-logo.svg new file mode 100644 index 0000000..6cbe665 --- /dev/null +++ b/assets/images/carpentries-logo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/data-logo-sm.svg b/assets/images/data-logo-sm.svg new file mode 100644 index 0000000..6d4019e --- /dev/null +++ b/assets/images/data-logo-sm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/data-logo.svg b/assets/images/data-logo.svg new file mode 100644 index 0000000..c594952 --- /dev/null +++ b/assets/images/data-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/dropdown-arrow.svg b/assets/images/dropdown-arrow.svg new file mode 100644 index 0000000..a12b04b --- /dev/null +++ b/assets/images/dropdown-arrow.svg @@ -0,0 +1,12 @@ + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Discussion

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +
+ +
+ + +

FIXME

+ + +
+
+ + +
+
+ + + diff --git a/docsearch.css b/docsearch.css new file mode 100644 index 0000000..e5f1fe1 --- /dev/null +++ b/docsearch.css @@ -0,0 +1,148 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + width: 110px; + height: 20px; + z-index: 3; + margin-top: 10.66667px; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml;utf8,"); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 100%; + height: 100%; + display: block; + transform: translate(-8px); +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docsearch.js b/docsearch.js new file mode 100644 index 0000000..b35504c --- /dev/null +++ b/docsearch.js @@ -0,0 +1,85 @@ +$(function() { + + // register a handler to move the focus to the search bar + // upon pressing shift + "/" (i.e. "?") + $(document).on('keydown', function(e) { + if (e.shiftKey && e.keyCode == 191) { + e.preventDefault(); + $("#search-input").focus(); + } + }); + + $(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); + }); +}); + +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/favicon-16x16.png b/favicon-16x16.png new file mode 100644 index 0000000..d44f8ac Binary files /dev/null and b/favicon-16x16.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png new file mode 100644 index 0000000..63441d4 Binary files /dev/null and b/favicon-32x32.png differ diff --git a/favicons/cp/apple-touch-icon-114x114.png b/favicons/cp/apple-touch-icon-114x114.png new file mode 100644 index 0000000..a60b758 Binary files /dev/null and b/favicons/cp/apple-touch-icon-114x114.png differ diff --git a/favicons/cp/apple-touch-icon-120x120.png b/favicons/cp/apple-touch-icon-120x120.png new file mode 100644 index 0000000..8f20a8f Binary files /dev/null and b/favicons/cp/apple-touch-icon-120x120.png differ diff --git a/favicons/cp/apple-touch-icon-144x144.png b/favicons/cp/apple-touch-icon-144x144.png new file mode 100644 index 0000000..4be151b Binary files /dev/null and b/favicons/cp/apple-touch-icon-144x144.png differ diff --git a/favicons/cp/apple-touch-icon-152x152.png b/favicons/cp/apple-touch-icon-152x152.png new file mode 100644 index 0000000..7d1d943 Binary files /dev/null and b/favicons/cp/apple-touch-icon-152x152.png differ diff --git a/favicons/cp/apple-touch-icon-57x57.png b/favicons/cp/apple-touch-icon-57x57.png new file mode 100644 index 0000000..92309ce Binary files /dev/null and b/favicons/cp/apple-touch-icon-57x57.png differ diff --git a/favicons/cp/apple-touch-icon-60x60.png b/favicons/cp/apple-touch-icon-60x60.png new file mode 100644 index 0000000..de8148e Binary files /dev/null and b/favicons/cp/apple-touch-icon-60x60.png differ diff --git a/favicons/cp/apple-touch-icon-72x72.png b/favicons/cp/apple-touch-icon-72x72.png new file mode 100644 index 0000000..81d7e3d Binary files /dev/null and b/favicons/cp/apple-touch-icon-72x72.png differ diff --git a/favicons/cp/apple-touch-icon-76x76.png b/favicons/cp/apple-touch-icon-76x76.png new file mode 100644 index 0000000..15bca5c Binary files /dev/null and b/favicons/cp/apple-touch-icon-76x76.png differ diff --git a/favicons/cp/favicon-128.png b/favicons/cp/favicon-128.png new file mode 100644 index 0000000..e612cdc Binary files /dev/null and b/favicons/cp/favicon-128.png differ diff --git a/favicons/cp/favicon-16x16.png b/favicons/cp/favicon-16x16.png new file mode 100644 index 0000000..65b3311 Binary files /dev/null and b/favicons/cp/favicon-16x16.png differ diff --git a/favicons/cp/favicon-196x196.png b/favicons/cp/favicon-196x196.png new file mode 100644 index 0000000..0da938b Binary files /dev/null and b/favicons/cp/favicon-196x196.png differ diff --git a/favicons/cp/favicon-32x32.png b/favicons/cp/favicon-32x32.png new file mode 100644 index 0000000..0c1442e Binary files /dev/null and b/favicons/cp/favicon-32x32.png differ diff --git a/favicons/cp/favicon-96x96.png b/favicons/cp/favicon-96x96.png new file mode 100644 index 0000000..bed74ec Binary files /dev/null and b/favicons/cp/favicon-96x96.png differ diff --git a/favicons/cp/favicon.ico b/favicons/cp/favicon.ico new file mode 100644 index 0000000..4f2f2f1 Binary files /dev/null and b/favicons/cp/favicon.ico differ diff --git a/favicons/cp/mstile-144x144.png b/favicons/cp/mstile-144x144.png new file mode 100644 index 0000000..4be151b Binary files /dev/null and b/favicons/cp/mstile-144x144.png differ diff --git a/favicons/cp/mstile-150x150.png b/favicons/cp/mstile-150x150.png new file mode 100644 index 0000000..bf7ad5e Binary files /dev/null and b/favicons/cp/mstile-150x150.png differ diff --git a/favicons/cp/mstile-310x150.png b/favicons/cp/mstile-310x150.png new file mode 100644 index 0000000..6ac8048 Binary files /dev/null and b/favicons/cp/mstile-310x150.png differ diff --git a/favicons/cp/mstile-310x310.png b/favicons/cp/mstile-310x310.png new file mode 100644 index 0000000..b778147 Binary files /dev/null and b/favicons/cp/mstile-310x310.png differ diff --git a/favicons/cp/mstile-70x70.png b/favicons/cp/mstile-70x70.png new file mode 100644 index 0000000..e612cdc Binary files /dev/null and b/favicons/cp/mstile-70x70.png differ diff --git a/favicons/dc/apple-touch-icon-114x114.png b/favicons/dc/apple-touch-icon-114x114.png new file mode 100644 index 0000000..edafbda Binary files /dev/null and b/favicons/dc/apple-touch-icon-114x114.png differ diff --git a/favicons/dc/apple-touch-icon-120x120.png b/favicons/dc/apple-touch-icon-120x120.png new file mode 100644 index 0000000..ee145ec Binary files /dev/null and b/favicons/dc/apple-touch-icon-120x120.png differ diff --git a/favicons/dc/apple-touch-icon-144x144.png b/favicons/dc/apple-touch-icon-144x144.png new file mode 100644 index 0000000..bf50701 Binary files /dev/null and b/favicons/dc/apple-touch-icon-144x144.png differ diff --git a/favicons/dc/apple-touch-icon-152x152.png b/favicons/dc/apple-touch-icon-152x152.png new file mode 100644 index 0000000..bd596c8 Binary files /dev/null and b/favicons/dc/apple-touch-icon-152x152.png differ diff --git a/favicons/dc/apple-touch-icon-57x57.png b/favicons/dc/apple-touch-icon-57x57.png new file mode 100644 index 0000000..61c1527 Binary files /dev/null and b/favicons/dc/apple-touch-icon-57x57.png differ diff --git a/favicons/dc/apple-touch-icon-60x60.png b/favicons/dc/apple-touch-icon-60x60.png new file mode 100644 index 0000000..9daad36 Binary files /dev/null and b/favicons/dc/apple-touch-icon-60x60.png differ diff --git a/favicons/dc/apple-touch-icon-72x72.png b/favicons/dc/apple-touch-icon-72x72.png new file mode 100644 index 0000000..2069520 Binary files /dev/null and b/favicons/dc/apple-touch-icon-72x72.png differ diff --git a/favicons/dc/apple-touch-icon-76x76.png b/favicons/dc/apple-touch-icon-76x76.png new file mode 100644 index 0000000..3db01ca Binary files /dev/null and b/favicons/dc/apple-touch-icon-76x76.png differ diff --git a/favicons/dc/favicon-128.png b/favicons/dc/favicon-128.png new file mode 100644 index 0000000..9e3de2a Binary files /dev/null and b/favicons/dc/favicon-128.png differ diff --git a/favicons/dc/favicon-16x16.png b/favicons/dc/favicon-16x16.png new file mode 100644 index 0000000..4c9f9b8 Binary files /dev/null and b/favicons/dc/favicon-16x16.png differ diff --git a/favicons/dc/favicon-196x196.png b/favicons/dc/favicon-196x196.png new file mode 100644 index 0000000..588afc2 Binary files /dev/null and b/favicons/dc/favicon-196x196.png differ diff --git a/favicons/dc/favicon-32x32.png b/favicons/dc/favicon-32x32.png new file mode 100644 index 0000000..9c2ecbf Binary files /dev/null and b/favicons/dc/favicon-32x32.png differ diff --git a/favicons/dc/favicon-96x96.png b/favicons/dc/favicon-96x96.png new file mode 100644 index 0000000..ff13fc0 Binary files /dev/null and b/favicons/dc/favicon-96x96.png differ diff --git a/favicons/dc/favicon.ico b/favicons/dc/favicon.ico new file mode 100644 index 0000000..e4715f3 Binary files /dev/null and b/favicons/dc/favicon.ico differ diff --git a/favicons/dc/mstile-144x144.png b/favicons/dc/mstile-144x144.png new file mode 100644 index 0000000..bf50701 Binary files /dev/null and b/favicons/dc/mstile-144x144.png differ diff --git a/favicons/dc/mstile-150x150.png b/favicons/dc/mstile-150x150.png new file mode 100644 index 0000000..c5844cc Binary files /dev/null and b/favicons/dc/mstile-150x150.png differ diff --git a/favicons/dc/mstile-310x150.png b/favicons/dc/mstile-310x150.png new file mode 100644 index 0000000..786813a Binary files /dev/null and b/favicons/dc/mstile-310x150.png differ diff --git a/favicons/dc/mstile-310x310.png b/favicons/dc/mstile-310x310.png new file mode 100644 index 0000000..9580653 Binary files /dev/null and b/favicons/dc/mstile-310x310.png differ diff --git a/favicons/dc/mstile-70x70.png b/favicons/dc/mstile-70x70.png new file mode 100644 index 0000000..9e3de2a Binary files /dev/null and b/favicons/dc/mstile-70x70.png differ diff --git a/favicons/lc/apple-touch-icon-114x114.png b/favicons/lc/apple-touch-icon-114x114.png new file mode 100644 index 0000000..6c83127 Binary files /dev/null and b/favicons/lc/apple-touch-icon-114x114.png differ diff --git a/favicons/lc/apple-touch-icon-120x120.png b/favicons/lc/apple-touch-icon-120x120.png new file mode 100644 index 0000000..8334648 Binary files /dev/null and b/favicons/lc/apple-touch-icon-120x120.png differ diff --git a/favicons/lc/apple-touch-icon-144x144.png b/favicons/lc/apple-touch-icon-144x144.png new file mode 100644 index 0000000..5f32151 Binary files /dev/null and b/favicons/lc/apple-touch-icon-144x144.png differ diff --git a/favicons/lc/apple-touch-icon-152x152.png b/favicons/lc/apple-touch-icon-152x152.png new file mode 100644 index 0000000..4e5c177 Binary files /dev/null and b/favicons/lc/apple-touch-icon-152x152.png differ diff --git a/favicons/lc/apple-touch-icon-57x57.png b/favicons/lc/apple-touch-icon-57x57.png new file mode 100644 index 0000000..61f9c9c Binary files /dev/null and b/favicons/lc/apple-touch-icon-57x57.png differ diff --git a/favicons/lc/apple-touch-icon-60x60.png b/favicons/lc/apple-touch-icon-60x60.png new file mode 100644 index 0000000..ccb5ada Binary files /dev/null and b/favicons/lc/apple-touch-icon-60x60.png differ diff --git a/favicons/lc/apple-touch-icon-72x72.png b/favicons/lc/apple-touch-icon-72x72.png new file mode 100644 index 0000000..517d459 Binary files /dev/null and b/favicons/lc/apple-touch-icon-72x72.png differ diff --git a/favicons/lc/apple-touch-icon-76x76.png b/favicons/lc/apple-touch-icon-76x76.png new file mode 100644 index 0000000..17454b3 Binary files /dev/null and b/favicons/lc/apple-touch-icon-76x76.png differ diff --git a/favicons/lc/favicon-128.png b/favicons/lc/favicon-128.png new file mode 100644 index 0000000..9d781c9 Binary files /dev/null and b/favicons/lc/favicon-128.png differ diff --git a/favicons/lc/favicon-16x16.png b/favicons/lc/favicon-16x16.png new file mode 100644 index 0000000..3c20abc Binary files /dev/null and b/favicons/lc/favicon-16x16.png differ diff --git a/favicons/lc/favicon-196x196.png b/favicons/lc/favicon-196x196.png new file mode 100644 index 0000000..46baaf8 Binary files /dev/null and b/favicons/lc/favicon-196x196.png differ diff --git a/favicons/lc/favicon-32x32.png b/favicons/lc/favicon-32x32.png new file mode 100644 index 0000000..ed6701e Binary files /dev/null and b/favicons/lc/favicon-32x32.png differ diff --git a/favicons/lc/favicon-96x96.png b/favicons/lc/favicon-96x96.png new file mode 100644 index 0000000..bc468c7 Binary files /dev/null and b/favicons/lc/favicon-96x96.png differ diff --git a/favicons/lc/favicon.ico b/favicons/lc/favicon.ico new file mode 100644 index 0000000..5c14e80 Binary files /dev/null and b/favicons/lc/favicon.ico differ diff --git a/favicons/lc/mstile-144x144.png b/favicons/lc/mstile-144x144.png new file mode 100644 index 0000000..5f32151 Binary files /dev/null and b/favicons/lc/mstile-144x144.png differ diff --git a/favicons/lc/mstile-150x150.png b/favicons/lc/mstile-150x150.png new file mode 100644 index 0000000..924953a Binary files /dev/null and b/favicons/lc/mstile-150x150.png differ diff --git a/favicons/lc/mstile-310x150.png b/favicons/lc/mstile-310x150.png new file mode 100644 index 0000000..e4dcda4 Binary files /dev/null and b/favicons/lc/mstile-310x150.png differ diff --git a/favicons/lc/mstile-310x310.png b/favicons/lc/mstile-310x310.png new file mode 100644 index 0000000..a12c876 Binary files /dev/null and b/favicons/lc/mstile-310x310.png differ diff --git a/favicons/lc/mstile-70x70.png b/favicons/lc/mstile-70x70.png new file mode 100644 index 0000000..9d781c9 Binary files /dev/null and b/favicons/lc/mstile-70x70.png differ diff --git a/favicons/swc/apple-touch-icon-114x114.png b/favicons/swc/apple-touch-icon-114x114.png new file mode 100644 index 0000000..e5125f8 Binary files /dev/null and b/favicons/swc/apple-touch-icon-114x114.png differ diff --git a/favicons/swc/apple-touch-icon-120x120.png b/favicons/swc/apple-touch-icon-120x120.png new file mode 100644 index 0000000..0f97a0a Binary files /dev/null and b/favicons/swc/apple-touch-icon-120x120.png differ diff --git a/favicons/swc/apple-touch-icon-144x144.png b/favicons/swc/apple-touch-icon-144x144.png new file mode 100644 index 0000000..7441446 Binary files /dev/null and b/favicons/swc/apple-touch-icon-144x144.png differ diff --git a/favicons/swc/apple-touch-icon-152x152.png b/favicons/swc/apple-touch-icon-152x152.png new file mode 100644 index 0000000..45cc338 Binary files /dev/null and b/favicons/swc/apple-touch-icon-152x152.png differ diff --git a/favicons/swc/apple-touch-icon-57x57.png b/favicons/swc/apple-touch-icon-57x57.png new file mode 100644 index 0000000..e180a4a Binary files /dev/null and b/favicons/swc/apple-touch-icon-57x57.png differ diff --git a/favicons/swc/apple-touch-icon-60x60.png b/favicons/swc/apple-touch-icon-60x60.png new file mode 100644 index 0000000..c96fd6c Binary files /dev/null and b/favicons/swc/apple-touch-icon-60x60.png differ diff --git a/favicons/swc/apple-touch-icon-72x72.png b/favicons/swc/apple-touch-icon-72x72.png new file mode 100644 index 0000000..aae014a Binary files /dev/null and b/favicons/swc/apple-touch-icon-72x72.png differ diff --git a/favicons/swc/apple-touch-icon-76x76.png b/favicons/swc/apple-touch-icon-76x76.png new file mode 100644 index 0000000..2167f94 Binary files /dev/null and b/favicons/swc/apple-touch-icon-76x76.png differ diff --git a/favicons/swc/favicon-128.png b/favicons/swc/favicon-128.png new file mode 100644 index 0000000..f61df62 Binary files /dev/null and b/favicons/swc/favicon-128.png differ diff --git a/favicons/swc/favicon-16x16.png b/favicons/swc/favicon-16x16.png new file mode 100644 index 0000000..2d20a40 Binary files /dev/null and b/favicons/swc/favicon-16x16.png differ diff --git a/favicons/swc/favicon-196x196.png b/favicons/swc/favicon-196x196.png new file mode 100644 index 0000000..2a20d3a Binary files /dev/null and b/favicons/swc/favicon-196x196.png differ diff --git a/favicons/swc/favicon-32x32.png b/favicons/swc/favicon-32x32.png new file mode 100644 index 0000000..f622b73 Binary files /dev/null and b/favicons/swc/favicon-32x32.png differ diff --git a/favicons/swc/favicon-96x96.png b/favicons/swc/favicon-96x96.png new file mode 100644 index 0000000..5e57f66 Binary files /dev/null and b/favicons/swc/favicon-96x96.png differ diff --git a/favicons/swc/favicon.ico b/favicons/swc/favicon.ico new file mode 100644 index 0000000..f771790 Binary files /dev/null and b/favicons/swc/favicon.ico differ diff --git a/favicons/swc/mstile-144x144.png b/favicons/swc/mstile-144x144.png new file mode 100644 index 0000000..7441446 Binary files /dev/null and b/favicons/swc/mstile-144x144.png differ diff --git a/favicons/swc/mstile-150x150.png b/favicons/swc/mstile-150x150.png new file mode 100644 index 0000000..d1594bc Binary files /dev/null and b/favicons/swc/mstile-150x150.png differ diff --git a/favicons/swc/mstile-310x150.png b/favicons/swc/mstile-310x150.png new file mode 100644 index 0000000..f7d58b2 Binary files /dev/null and b/favicons/swc/mstile-310x150.png differ diff --git a/favicons/swc/mstile-310x310.png b/favicons/swc/mstile-310x310.png new file mode 100644 index 0000000..b632b42 Binary files /dev/null and b/favicons/swc/mstile-310x310.png differ diff --git a/favicons/swc/mstile-70x70.png b/favicons/swc/mstile-70x70.png new file mode 100644 index 0000000..f61df62 Binary files /dev/null and b/favicons/swc/mstile-70x70.png differ diff --git a/fig/git-committing.svg b/fig/git-committing.svg new file mode 100644 index 0000000..71b9dca --- /dev/null +++ b/fig/git-committing.svg @@ -0,0 +1,436 @@ + + + +image/svg+xml.git +FILE1.txt +FILE2.txt +git commit +staging area +repository +git add FILE2.txt +git add FILE1.txt + \ No newline at end of file diff --git a/fig/git-staging-area.svg b/fig/git-staging-area.svg new file mode 100644 index 0000000..b141c9f --- /dev/null +++ b/fig/git-staging-area.svg @@ -0,0 +1,93 @@ + + + + + + + + .git + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + git add + + + + + + git commit + + staging area + + repository + + diff --git a/fig/git_staging.svg b/fig/git_staging.svg new file mode 100644 index 0000000..dd59510 --- /dev/null +++ b/fig/git_staging.svg @@ -0,0 +1,675 @@ + + + +image/svg+xmla2129cb + +892134f + +59e230a + +3a54f76 + +43fe423 + + + + branch + +main + +staging area + +git add file2.txt + +git add file1.txt + +HEADHEAD~1HEAD~2 + +git commit + +git checkout HEAD file1.txt + + + diff --git a/fig/phd_comic_versions.gif b/fig/phd_comic_versions.gif new file mode 100644 index 0000000..721323e Binary files /dev/null and b/fig/phd_comic_versions.gif differ diff --git a/images.html b/images.html new file mode 100644 index 0000000..06107cf --- /dev/null +++ b/images.html @@ -0,0 +1,550 @@ + + + + + +Git for Official Statistics: All Images + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+ + +

Introduction

+
+

Figure 1

+ +
Web comic about sending a file back and forth using the file name as version control

Version Control

+

Setting up Git

+

Creating a Repository

+

Tracking Changes

+
+

Figure 1

+ +
The Git Staging Area

+

Figure 2

+ +
The Git Commit Workflow

Exploring History

+

Ignoring Things

+

Remotes in GitLab/GitHub

+

Collaborating

+

Conflicts

+

Working with Others in GitHub/GitLab

+

Documenting in GitHub/GitLab for official statistics

+

Citation

+
+
+
+
+ + +
+ + +
+ + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..d2f2b28 --- /dev/null +++ b/index.html @@ -0,0 +1,496 @@ + +Git for Official Statistics: Summary and Setup +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+

Summary and Setup

+ + +

Project Introduction +

+

Git for Official Statistics is part of the UNECE HLG-MOS ModernStats +Carpentries project. This is one out of a series of lessons that have +been modified from Software Carpentries to meet the needs of +organizations producing official statistics as they upskill their +workforces.

+

Git for official statistics is intended for beginners to novices. +This lesson is designed to introduce the basics of using Git while +working with others. Additionally, this lesson covers best practices for +using Git in the context of official statistics.

+

There are plans to translate this lesson into French following the +completion of the content in English. Official statistics organizations +and community members are welcome and encouraged to translate the +contents of the lesson into additional languages to meet their +needs.

+

If you are interested in running a session, please feel free to +contact the owners on the project through the repository for this +lesson

+

Notes on using this lesson +

+

This lesson is designed to be modular, allowing for instructors to +select and deliver chapters to their audiences as needed. For senior +managers, managers, and low-code environment employees, a minimum of +chapter 1 is recommended. Employees in low-code environments may need +additional chapters depending on what actions they will be doing with +Git.

+

This lesson is designed to be ~4 hours of content delivered over 6 +hours with breaks to reduce cognitive load on participants instructors. +It can be delivered digitally and in-person.

+

Following the Carpentries model, it is recommended this training be +delivered synchronously, and not recorded.

+
+
+ +
+
+

Prerequisites +

+
+

Installation of Git and a GitHub account.

+
+
+
+

FIXME

+ +
+ + +
+
+ + + diff --git a/instructor-notes.html b/instructor-notes.html new file mode 100644 index 0000000..850a2a9 --- /dev/null +++ b/instructor-notes.html @@ -0,0 +1,530 @@ + + + + + +Git for Official Statistics: Instructor Notes + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+

Instructor Notes

+ +

FIXME

+ +
+
+
+
+ + +
+ + +
+ + + + + diff --git a/instructor/01-introduction.html b/instructor/01-introduction.html new file mode 100644 index 0000000..02b16e3 --- /dev/null +++ b/instructor/01-introduction.html @@ -0,0 +1,574 @@ + +Git for Official Statistics: Introduction +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Introduction

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 10 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • Why use version control in official statistics?
  • +
+
+
+
+
+
+

Objectives

+
  • Identify uses and purposes for using Git in official statistics
  • +
+
+
+
+
+

Version Control in General +

+

Version control is important whether you are working alone or +collaboratively, even if you are not working in statistics!

+

Here’s the basics of how a version control system works:

+
  • start with a base version of a document
  • +
  • record changes made each step of the way
  • +
  • collaborators can add changes in independently without conflict
  • +
Web comic about sending a file back and forth using the file name as version control

You’ve probably already seen a version control system.

+

Good version control systems will allow you to see the history of a +project and will sync across different computers, facilitating +collaboration.

+
+
+ +
+
+

Version Control Systems +

+
+

What version control systems have you likely already come across? +List 1-2

+
+
+
+
+
+ +
+
+

You’ve probably seen Microsoft’s Track Changes and Google Doc’s +version history

+
+
+
+
+

Why Version Controlling Matters in Official Statistics +

+

There are a number of reasons why version control matters matters in +official statistics:

+
  1. Reproducibility: Within and across organizations, we need to be +able to reproduce statistics. This could be to ensure consistency in +methodology across reference periods, or check to see if statistics are +comparable in their methodologies.

  2. +
  3. Standardization: We can use version control systems as a single +source of truth to create standardization of statistics between and +within organizations.

  4. +
  5. Disseminate changes and updated versions: Following our single +source of truth, we can easily update and share changes to calculations +of official statistics as well as any new documentation or +methodologies. This means we are updating in one place rather than +many.

  6. +
  7. Collaboration: Version control systems allow us to collaborate +and connect on the creation of official statistics internally and +externally with stakeholders. We can use these systems to share proposed +changes, share work, and test code.

  8. +
  9. Efficient and Effective Development of Code: With a single source +of truth, we know exactly where to propose and find changes code that +makes our statistics. In addition, many version control systems have +project management or feedback tools that we can leverage to bundle +communication and discussion with the code itself rather than working in +multiple systems. This can allow for faster feedback and proposed +updates.

  10. +
+
+ + +
+
+ + + diff --git a/instructor/02-version_control.html b/instructor/02-version_control.html new file mode 100644 index 0000000..592cc15 --- /dev/null +++ b/instructor/02-version_control.html @@ -0,0 +1,520 @@ + +Git for Official Statistics: Version Control +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Version Control

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 10 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • What is Git?
  • +
  • Why should I use it?
  • +
  • How does it relate to open statistics?
  • +
+
+
+
+
+
+

Objectives

+
  • Identify key concepts in version control and its use in official +statistics
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/03-git_setup.html b/instructor/03-git_setup.html new file mode 100644 index 0000000..dbe8087 --- /dev/null +++ b/instructor/03-git_setup.html @@ -0,0 +1,695 @@ + +Git for Official Statistics: Setting up Git +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Setting up Git

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 5 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I set up Git?
  • +
+
+
+
+
+
+

Objectives

+
  • Configure basic settings in Git
  • +
+
+
+
+
+

Before we start using Git for the first time on a new computer, there +are some things we need to set up. In this lesson, we will:

+
  • Add a name and email address
  • +
  • Set the text editor used for writing commit messages
  • +
  • Understand the difference between --global and +--local configuration
  • +
  • View/confirm configuration settings
  • +

We will be using Git Bash, the command line interface for Git.

+

Configure Name and Email +

+

An important first step in using Git is adding your name and email. +This information will be attached to commits, +branches, +and other changes you make in the future. This identifiability and +accountability for code changes is one of the key benefits to using +Git.

+

At the Git Bash prompt, enter the following, substituting your full +name for the name in quotation marks after user.name and +your email for the email address following user.email.

+
+

BASH +

+
$ git config --global user.name "Jane Doe"
+$ git config --global user.email "doe_jane@agency.gov"
+
+

Your situation may vary, but if you are writing code in your official +capacity and using an agency repository, you will most likely want to +use your official email address and the one associated with your account +on GitHub, GitLab, or other code sharing site.

+

Configure Text Editor +

+
+

This is optional. By default, Git Bash will use the Vim text +editor.

+
+

There are many different Git clients and ways of interacting with Git +on your computer. Some clients have a full user interface that you use +for selecting files to stage for commits and authoring commit messages. +Others, like Git Bash, have a command line interface so when you want to +write a lengthy commit message, it needs to call up a text editor.

+
+
+ +
+
+

Different Ways to Author Commit Messages +

+
+

As you will learn in a +later lesson, once you make updates to your code, you will want to +make a snapshot of those updates called a commit and provide an +informative message that describes what was changed. This message can be +short and be written on the command line (e.g., +git commit -m "Update README.md"). Sometimes however, you +will want to write a longer, multi-line commit message. You can do this +by entering git commit on the command line. This will bring +up the text editor you have configured as your default.

+
+
+
+

The default text editor for Git Bash is Vim which has a reputation +for being difficult, especially for new users. So you may want to change +to something easier to use or something you are more familiar with +(e.g., your favorite text editor).

+

To switch to one of the following editors in the tables below, you +can use the associated configuration commands.

+

The nano text editor is packaged with Git Bash and Notepad is +included in the Windows operating system.

+ + + + + + +
EditorConfiguration command
nano$ git config --global core.editor "nano -w"
Notepad (Win)$ git config --global core.editor "c:/Windows/System32/notepad.exe"

The text editors below are not available by default, but you may be +available to you. Setup for these is more complex because it requires +providing a filepath to the program executable which may not be the same +for everyone.

+ + + + + + + + +
EditorConfiguration command
Notepad++ (Win, 64-bit install)$ git config --global core.editor "'c:/program files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Sublime Text (Win, 64-bit install)$ git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
VS Code$ git config --global core.editor "code --wait"

If you ever want to switch back to Vim as the default, you can run +the following command.

+ + + + +
EditorConfiguration command
Vim$ git config --global core.editor "vim"
+
+ +
+
+

Exiting Vim +

+
+

Vim is surprisingly difficult to exit from. If you wish to exit a +session without saving your changes, press Esc then type +:q! and hit Enter or . If you want +to save your changes and quit, press Esc then type +:wq and hit Enter or .

+
+
+
+

+--global vs. --local +

+

In the code samples above, we have used the --global +flag. These are the settings Git will use for all repositories on your +computer. As your use of Git becomes more complex, you may wish to have +different configuration settings for different repositories. This is +when you might use the --local flag. --local +allows you to set configuration for specific repositories.

+

To set local configuration, open Git Bash and navigate to the +repository you want to configure. You can then use the commands above, +but substitute --local for --global.

+

For example, if you want to set a different name or email address for +a specific project, you can do so with commands like those below.

+
+

BASH +

+
$ git config --local user.name "Jane R Doe"
+$ git config --local user.email "janedoe@example.com"
+
+

These settings will override the --global configuration +settings for that repository only.

+

View/Confirm Configuration +

+

You may wish to check your configuration settings.

+

To see all configuration settings, you can use the following command. +If you are in a repository, this will show all global and local +configuration settings.

+
+

BASH +

+
$ git config --list
+
+

To view global settings only (Note: This command can be run +anywhere):

+
+

BASH +

+
$ git config --global --list
+
+

To view local settings only (Note: This has to be run while +in a repository):

+
+

BASH +

+
$ git config --local --list
+
+

To view specific settings, include the setting name. For example, to +view the email address configuration setting:

+
+

BASH +

+
$ git config user.email 
+
+

Other Configuration Settings +

+

There are other, optional configuration settings you may wish to +change. Review Git documentation and consult with others on your team +about other settings.

+
+
+ +
+
+

Key Points +

+
+
  • Use git config with the --global option to +configure a user name, email address, editor, and other preferences once +per machine.
  • +
  • Use --local in place of --global within a +repository to set repository specific changes.
  • +
+
+
+
+
+ + +
+
+ + + diff --git a/instructor/04-create_repo.html b/instructor/04-create_repo.html new file mode 100644 index 0000000..39ef7a9 --- /dev/null +++ b/instructor/04-create_repo.html @@ -0,0 +1,517 @@ + +Git for Official Statistics: Creating a Repository +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Creating a Repository

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 10 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • Where does Git store information?
  • +
+
+
+
+
+
+

Objectives

+
  • Create a repository in a local folder
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/05-track_changes.html b/instructor/05-track_changes.html new file mode 100644 index 0000000..e955c65 --- /dev/null +++ b/instructor/05-track_changes.html @@ -0,0 +1,1353 @@ + +Git for Official Statistics: Tracking Changes +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Tracking Changes

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 20 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I record changes in Git?
  • +
  • How do I check the status of my version control repository?
  • +
  • How do I record notes about what changes I made and why?
  • +
+
+
+
+
+
+

Objectives

+
  • Check the history of a file
  • +
  • Use add and commit to record changes
  • +
  • Create commit messages that are descriptive
  • +
+
+
+
+
+

Note This lesson has been adapted from Lesson 4 +of Version Control with Git

+

Getting Started +

+

First let’s make sure we’re still in the right directory. You should +be in the planets directory.

+
+

BASH +

+
$ cd ~/Desktop/planets
+
+

Let’s create a file called mars.txt that contains some +notes about the Red Planet’s suitability as a base. We’ll use +nano to edit the file; you can use whatever editor you +like. In particular, this does not have to be the +core.editor you set globally earlier. But remember, the +bash command to create or edit a new file will depend on the editor you +choose (it might not be nano). For a refresher on text +editors, check out “Which +Editor?” in The Unix Shell +lesson.

+
+

BASH +

+
$ nano mars.txt
+
+

Type the text below into the mars.txt file:

+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

Let’s first verify that the file was properly created by running the +list command (ls):

+
+

BASH +

+
$ ls
+
+
+

OUTPUT +

+
mars.txt
+
+

mars.txt contains a single line, which we can see by +running:

+
+

BASH +

+
$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

If we check the status of our project again, Git tells us that it’s +noticed the new file:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Untracked files:
+   (use "git add <file>..." to include in what will be committed)
+
+	mars.txt
+
+nothing added to commit but untracked files present (use "git add" to track)
+
+

The “untracked files” message means that there’s a file in the +directory that Git isn’t keeping track of. We can tell Git to track a +file using git add:

+
+

BASH +

+
$ git add mars.txt
+
+

and then check that the right thing happened:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Changes to be committed:
+  (use "git rm --cached <file>..." to unstage)
+
+	new file:   mars.txt
+
+
+

Git now knows that it’s supposed to keep track of +mars.txt, but it hasn’t recorded these changes as a commit +yet. To get it to do that, we need to run one more command:

+
+

BASH +

+
$ git commit -m "Start notes on Mars as a base"
+
+
+

OUTPUT +

+
[main (root-commit) f22b25e] Start notes on Mars as a base
+ 1 file changed, 1 insertion(+)
+ create mode 100644 mars.txt
+
+

When we run git commit, Git takes everything we have +told it to save by using git add and stores a copy +permanently inside the special .git directory. This +permanent copy is called a commit +(or revision) and its short +identifier is f22b25e. Your commit may have another +identifier.

+

We use the -m flag (for “message”) to record a short, +descriptive, and specific comment that will help us remember later on +what we did and why. If we just run git commit without the +-m option, Git will launch nano (or whatever +other editor we configured as core.editor) so that we can +write a longer message.

+

[Good commit messages][commit-messages] start with a brief (<50 +characters) statement about the changes made in the commit. Generally, +the message should complete the sentence “If applied, this commit will” +. If you want to go into more detail, add a blank +line between the summary line and your additional notes. Use this +additional space to explain why you made changes and/or what their +impact will be.

+

If we run git status now:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

it tells us everything is up to date. If we want to know what we’ve +done recently, we can ask Git to show us the project’s history using +git log:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+

git log lists all commits made to a repository in +reverse chronological order. The listing for each commit includes the +commit’s full identifier (which starts with the same characters as the +short identifier printed by the git commit command +earlier), the commit’s author, when it was created, and the log message +Git was given when the commit was created.

+
+
+ +
+
+

Where Are My Changes? +

+
+

If we run ls at this point, we will still see just one +file called mars.txt. That’s because Git saves information +about files’ history in the special .git directory +mentioned earlier so that our filesystem doesn’t become cluttered (and +so that we can’t accidentally edit or delete an old version).

+
+
+
+

Now suppose Dracula adds more information to the file. (Again, we’ll +edit with nano and then cat the file to show +its contents; you may use a different editor, and don’t need to +cat.)

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+
+

When we run git status now, it tells us that a file it +already knows about has been modified:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

The last line is the key phrase: “no changes added to commit”. We +have changed this file, but we haven’t told Git we will want to save +those changes (which we do with git add) nor have we saved +them (which we do with git commit). So let’s do that now. +It is good practice to always review our changes before saving them. We +do this using git diff. This shows us the differences +between the current state of the file and the most recently saved +version:

+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index df0654a..315bf3a 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1 +1,2 @@
+ Cold and dry, but everything is my favorite color
++The two moons may be a problem for Wolfman
+
+

The output is cryptic because it is actually a series of commands for +tools like editors and patch telling them how to +reconstruct one file given the other. If we break it down into +pieces:

+
  1. The first line tells us that Git is producing output similar to the +Unix diff command comparing the old and new versions of the +file.
  2. +
  3. The second line tells exactly which versions of the file Git is +comparing; df0654a and 315bf3a are unique +computer-generated labels for those versions.
  4. +
  5. The third and fourth lines once again show the name of the file +being changed.
  6. +
  7. The remaining lines are the most interesting, they show us the +actual differences and the lines on which they occur. In particular, the ++ marker in the first column shows where we added a +line.
  8. +

After reviewing our change, it’s time to commit it:

+
+

BASH +

+
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

Whoops: Git won’t commit because we didn’t use git add +first. Let’s fix that:

+
+

BASH +

+
$ git add mars.txt
+$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
[main 34961b1] Add concerns about effects of Mars' moons on Wolfman
+ 1 file changed, 1 insertion(+)
+
+

Git insists that we add files to the set we want to commit before +actually committing anything. This allows us to commit our changes in +stages and capture changes in logical portions rather than only large +batches. For example, suppose we’re adding a few citations to relevant +research to our thesis. We might want to commit those additions, and the +corresponding bibliography entries, but not commit some of our +work drafting the conclusion (which we haven’t finished yet).

+

To allow for this, Git has a special staging area where it +keeps track of things that have been added to the current changeset but not yet committed.

+
+
+ +
+
+

Staging Area +

+
+

If you think of Git as taking snapshots of changes over the life of a +project, git add specifies what will go in a +snapshot (putting things in the staging area), and +git commit then actually takes the snapshot, and +makes a permanent record of it (as a commit). If you don’t have anything +staged when you type git commit, Git will prompt you to use +git commit -a or git commit --all, which is +kind of like gathering everyone to take a group photo! However, +it’s almost always better to explicitly add things to the staging area, +because you might commit changes you forgot you made. (Going back to the +group photo simile, you might get an extra with incomplete makeup +walking on the stage for the picture because you used +-a!).

+

In the context of creating official statistics, using +--all or -a can lead to files being staged and +committed that should not be released (like microdata) or can cause +difficulties for others on the project (like environment files).

+

Staging things manually or using a pattern is the best practice, +otherwise you might find yourself searching for “git undo commit” more +than you would like!

+

Remember to use git status after you add files to check +what you have staged/added.

+
+
+
+
The Git Staging Area

Let’s watch as our changes to a file move from our editor to the +staging area and into long-term storage. First, we’ll add another line +to the file:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+But the Mummy will appreciate the lack of humidity
+
+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

So far, so good: we’ve added one line to the end of the file (shown +with a + in the first column). Now let’s put that change in +the staging area and see what git diff reports:

+
+

BASH +

+
$ git add mars.txt
+$ git diff
+
+

There is no output: as far as Git can tell, there’s no difference +between what it’s been asked to save permanently and what’s currently in +the directory. However, if we do this:

+
+

BASH +

+
$ git diff --staged
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

it shows us the difference between the last committed change and +what’s in the staging area. Let’s save our changes:

+
+

BASH +

+
$ git commit -m "Discuss concerns about Mars' climate for Mummy"
+
+
+

OUTPUT +

+
[main 005937f] Discuss concerns about Mars' climate for Mummy
+ 1 file changed, 1 insertion(+)
+
+

check our status:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

and look at the history of what we’ve done so far:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+    Discuss concerns about Mars' climate for Mummy
+
+commit 34961b159c27df3b475cfe4415d94a6d1fcd064d
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:07:21 2013 -0400
+
+    Add concerns about effects of Mars' moons on Wolfman
+
+commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+
+
+ +
+
+

Word-based diffing +

+
+

Sometimes, e.g. in the case of the text documents a line-wise diff is +too coarse. That is where the --color-words option of +git diff comes in very useful as it highlights the changed +words using colors.

+
+
+
+
+
+ +
+
+

Paging the Log +

+
+

When the output of git log is too long to fit in your +screen, git uses a program to split it into pages of the +size of your screen. When this “pager” is called, you will notice that +the last line in your screen is a :, instead of your usual +prompt.

+
  • To get out of the pager, press Q.
  • +
  • To move to the next page, press Spacebar.
  • +
  • To search for some_word in all pages, press +/ and type some_word. Navigate through matches +pressing N.
  • +
+
+
+
+
+ +
+
+

Limit Log Size +

+
+

To avoid having git log cover your entire terminal +screen, you can limit the number of commits that Git lists by using +-N, where N is the number of commits that you +want to view. For example, if you only want information from the last +commit you can use:

+
+

BASH +

+
$ git log -1
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+   Discuss concerns about Mars' climate for Mummy
+
+

You can also reduce the quantity of information using the +--oneline option:

+
+

BASH +

+
$ git log --oneline
+
+
+

OUTPUT +

+
005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+34961b1 Add concerns about effects of Mars' moons on Wolfman
+f22b25e Start notes on Mars as a base
+
+

You can also combine the --oneline option with others. +One useful combination adds --graph to display the commit +history as a text-based graph and to indicate which commits are +associated with the current HEAD, the current branch +main, or [other Git references][git-references]:

+
+

BASH +

+
$ git log --oneline --graph
+
+
+

OUTPUT +

+
* 005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+* 34961b1 Add concerns about effects of Mars' moons on Wolfman
+* f22b25e Start notes on Mars as a base
+
+
+
+
+
+
+ +
+
+

Directories +

+
+

Two important facts you should know about directories in Git.

+
  1. Git does not track directories on their own, only files within them. +Try it for yourself:
  2. +
+

BASH +

+
$ mkdir spaceships
+$ git status
+$ git add spaceships
+$ git status
+
+

Note, our newly created empty directory spaceships does +not appear in the list of untracked files even if we explicitly add it +(via git add) to our repository. This is the +reason why you will sometimes see .gitkeep files in +otherwise empty directories. Unlike .gitignore, these files +are not special and their sole purpose is to populate a directory so +that Git adds it to the repository. In fact, you can name such files +anything you like.

+
  1. If you create a directory in your Git repository and populate it +with files, you can add all files in the directory at once by:
  2. +
+

BASH +

+
git add <directory-with-files>
+
+

Try it for yourself:

+
+

BASH +

+
$ touch spaceships/apollo-11 spaceships/sputnik-1
+$ git status
+$ git add spaceships
+$ git status
+
+

Before moving on, we will commit these changes.

+
+

BASH +

+
$ git commit -m "Add some initial thoughts on spaceships"
+
+
+
+
+

To recap, when we want to add changes to our repository, we first +need to add the changed files to the staging area (git add) +and then commit the staged changes to the repository +(git commit):

+
The Git Commit Workflow
+
+ +
+
+

Choosing a Commit Message +

+
+

Which of the following commit messages would be most appropriate for +the last commit made to mars.txt?

+
  1. “Changes”
  2. +
  3. “Added line ‘But the Mummy will appreciate the lack of humidity’ to +mars.txt”
  4. +
  5. “Discuss effects of Mars’ climate on the Mummy”
  6. +
+
+
+
+
+ +
+
+

Answer 1 is not descriptive enough, and the purpose of the commit is +unclear; and answer 2 is redundant to using “git diff” to see what +changed in this commit; but answer 3 is good: short, descriptive, and +imperative.

+
+
+
+
+
+
+ +
+
+

Committing Changes to Git +

+
+

Which command(s) below would save the changes of +myfile.txt to my local Git repository?

+
  1. +

    BASH +

    +
      $ git commit -m "my recent changes"
    +
  2. +
  3. +

    BASH +

    +
      $ git init myfile.txt
    +  $ git commit -m "my recent changes"
    +
  4. +
  5. +

    BASH +

    +
      $ git add myfile.txt
    +  $ git commit -m "my recent changes"
    +
  6. +
  7. +

    BASH +

    +
      $ git commit -m myfile.txt "my recent changes"
    +
  8. +
+
+
+
+
+ +
+
+
  1. Would only create a commit if files have already been staged.
  2. +
  3. Would try to create a new repository.
  4. +
  5. Is correct: first add the file to the staging area, then +commit.
  6. +
  7. Would try to commit a file “my recent changes” with the message +myfile.txt.
  8. +
+
+
+
+
+
+ +
+
+

Committing Multiple Files +

+
+

The staging area can hold changes from any number of files that you +want to commit as a single snapshot.

+
  1. Add some text to mars.txt noting your decision to +consider Venus as a base
  2. +
  3. Create a new file venus.txt with your initial thoughts +about Venus as a base for you and your friends
  4. +
  5. Add changes from both files to the staging area, and commit those +changes.
  6. +
+
+
+
+
+ +
+
+

The output below from cat mars.txt reflects only content +added during this exercise. Your output may vary.

+

First we make our changes to the mars.txt and +venus.txt files:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Maybe I should start with a base on Venus.
+
+
+

BASH +

+
$ nano venus.txt
+$ cat venus.txt
+
+
+

OUTPUT +

+
Venus is a nice planet and I definitely should consider it as a base.
+
+

Now you can add both files to the staging area. We can do that in one +line:

+
+

BASH +

+
$ git add mars.txt venus.txt
+
+

Or with multiple commands:

+
+

BASH +

+
$ git add mars.txt
+$ git add venus.txt
+
+

Now the files are ready to commit. You can check that using +git status. If you are ready to commit use:

+
+

BASH +

+
$ git commit -m "Write plans to start a base on Venus"
+
+
+

OUTPUT +

+
[main cc127c2]
+ Write plans to start a base on Venus
+ 2 files changed, 2 insertions(+)
+ create mode 100644 venus.txt
+
+
+
+
+
+
+
+ +
+
+

+bio Repository +

+
+
  • Create a new Git repository on your computer called +bio.
  • +
  • Write a three-line biography for yourself in a file called +me.txt, commit your changes
  • +
  • Modify one line, add a fourth line
  • +
  • Display the differences between its updated state and its original +state.
  • +
+
+
+
+
+ +
+
+

If needed, move out of the planets folder:

+
+

BASH +

+
$ cd ..
+
+

Create a new folder called bio and ‘move’ into it:

+
+

BASH +

+
$ mkdir bio
+$ cd bio
+
+

Initialise git:

+
+

BASH +

+
$ git init
+
+

Create your biography file me.txt using +nano or another text editor. Once in place, add and commit +it to the repository:

+
+

BASH +

+
$ git add me.txt
+$ git commit -m "Add biography file" 
+
+

Modify the file as described (modify one line, add a fourth line). To +display the differences between its updated state and its original +state, use git diff:

+
+

BASH +

+
$ git diff me.txt
+
+
+
+
+
+
+
+ + +
+
+ + + diff --git a/instructor/06-exploring_history.html b/instructor/06-exploring_history.html new file mode 100644 index 0000000..b4788b3 --- /dev/null +++ b/instructor/06-exploring_history.html @@ -0,0 +1,520 @@ + +Git for Official Statistics: Exploring History +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Exploring History

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 25 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I identify old versions of files?
  • +
  • How do I review my changes?
  • +
  • How can I recover old versions of files?
  • +
+
+
+
+
+
+

Objectives

+
  • view commit history of a file
  • +
  • checkout an older version of a file
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/07-ignoring_things.html b/instructor/07-ignoring_things.html new file mode 100644 index 0000000..dbb304a --- /dev/null +++ b/instructor/07-ignoring_things.html @@ -0,0 +1,519 @@ + +Git for Official Statistics: Ignoring Things +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Ignoring Things

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 10 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I tell Git to ignore files I don’t want to track?
  • +
  • What do we have to watch for when creating official statistics?
  • +
+
+
+
+
+
+

Objectives

+
  • create a .gitignore
  • +
  • identify file types and areas of risk for official statistics
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/08-remotes.html b/instructor/08-remotes.html new file mode 100644 index 0000000..efaf9f9 --- /dev/null +++ b/instructor/08-remotes.html @@ -0,0 +1,517 @@ + +Git for Official Statistics: Remotes in GitLab/GitHub +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Remotes in GitLab/GitHub

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 45 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I share my changes with others on the web?
  • +
+
+
+
+
+
+

Objectives

+
  • Connect Git to a remote repository
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/09-collaborating.html b/instructor/09-collaborating.html new file mode 100644 index 0000000..84bd4c2 --- /dev/null +++ b/instructor/09-collaborating.html @@ -0,0 +1,517 @@ + +Git for Official Statistics: Collaborating +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Collaborating

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 35 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I use version control to collaborate with other people?
  • +
+
+
+
+
+
+

Objectives

+
  • Use Git and branches to work with others locally
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/10-conflicts.html b/instructor/10-conflicts.html new file mode 100644 index 0000000..5e2bbfe --- /dev/null +++ b/instructor/10-conflicts.html @@ -0,0 +1,517 @@ + +Git for Official Statistics: Conflicts +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Conflicts

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 15 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • What do I do when my changes conflict with someone else’s?
  • +
+
+
+
+
+
+

Objectives

+
  • Resolve a merge conflict
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/11-working_remotes.html b/instructor/11-working_remotes.html new file mode 100644 index 0000000..2d12d82 --- /dev/null +++ b/instructor/11-working_remotes.html @@ -0,0 +1,520 @@ + +Git for Official Statistics: Working with Others in GitHub/GitLab +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Working with Others in GitHub/GitLab

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 20 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I put work on the protected branch?
  • +
  • How can we keep track of what needs to be done?
  • +
  • How can I add collaborators?
  • +
+
+
+
+
+
+

Objectives

+
  • Add collaborators to a remote repository
  • +
  • use issues to keep track of project needs
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/12-documentation.html b/instructor/12-documentation.html new file mode 100644 index 0000000..e8d9e38 --- /dev/null +++ b/instructor/12-documentation.html @@ -0,0 +1,520 @@ + +Git for Official Statistics: Documenting in GitHub/GitLab for official statistics +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Documenting in GitHub/GitLab for official statistics

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 10 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How do I create documentation so others can understand my +methodology?
  • +
  • How can I host it easily on GitHub?
  • +
+
+
+
+
+
+

Objectives

+
  • Create documentation using markdown
  • +
  • add links and images to documentation
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/13-citation.html b/instructor/13-citation.html new file mode 100644 index 0000000..45a0f7b --- /dev/null +++ b/instructor/13-citation.html @@ -0,0 +1,517 @@ + +Git for Official Statistics: Citation +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Citation

+

Last updated on 2024-07-11 | + + Edit this page

+ + + +

Estimated time: 5 minutes

+ +
+ +
+ + + +
+

Overview

+
+
+
+
+

Questions

+
  • How can I make my work easier to cite?
  • +
+
+
+
+
+
+

Objectives

+
  • How to cite and be cited
  • +
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+ + + +
+
+ + +
+
+ + + diff --git a/instructor/404.html b/instructor/404.html new file mode 100644 index 0000000..31cb893 --- /dev/null +++ b/instructor/404.html @@ -0,0 +1,478 @@ + +Git for Official Statistics: Page not found +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Page not found

+ +

Our apologies! +

+

We cannot seem to find the page you are looking for. Here are some +tips that may help:

+
  1. try going back to the previous +page or
  2. +
  3. navigate to any other page using the navigation bar on the +left.
  4. +
  5. if the URL ends with /index.html, try removing +that.
  6. +
  7. head over to the home page of this +lesson +
  8. +

If you came here from a link in this lesson, please contact the +lesson maintainers using the links at the foot of this page.

+
+
+ + +
+
+ + + diff --git a/instructor/CODE_OF_CONDUCT.html b/instructor/CODE_OF_CONDUCT.html new file mode 100644 index 0000000..f5bf077 --- /dev/null +++ b/instructor/CODE_OF_CONDUCT.html @@ -0,0 +1,485 @@ + +Git for Official Statistics: Contributor Code of Conduct +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Contributor Code of Conduct

+

Last updated on 2024-07-11 | + + Edit this page

+ + + + + +
+ +
+ + + +

As contributors and maintainers of this project, we pledge to follow +the The +Carpentries Code of Conduct.

+

Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by following our reporting +guidelines.

+ + + +
+
+ + +
+
+ + + diff --git a/instructor/LICENSE.html b/instructor/LICENSE.html new file mode 100644 index 0000000..ae6f1dd --- /dev/null +++ b/instructor/LICENSE.html @@ -0,0 +1,536 @@ + +Git for Official Statistics: Licenses +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Licenses

+

Last updated on 2024-07-11 | + + Edit this page

+ + + + + +
+ +
+ + + +

Instructional Material +

+

All Carpentries (Software Carpentry, Data Carpentry, and Library +Carpentry) instructional material is made available under the Creative Commons +Attribution license. The following is a human-readable summary of +(and not a substitute for) the full legal +text of the CC BY 4.0 license.

+

You are free:

+
  • to Share—copy and redistribute the material in any +medium or format
  • +
  • to Adapt—remix, transform, and build upon the +material
  • +

for any purpose, even commercially.

+

The licensor cannot revoke these freedoms as long as you follow the +license terms.

+

Under the following terms:

+
  • Attribution—You must give appropriate credit +(mentioning that your work is derived from work that is Copyright (c) +The Carpentries and, where practical, linking to https://carpentries.org/), provide a link to the +license, and indicate if changes were made. You may do so in any +reasonable manner, but not in any way that suggests the licensor +endorses you or your use.

  • +
  • No additional restrictions—You may not apply +legal terms or technological measures that legally restrict others from +doing anything the license permits. With the understanding +that:

  • +

Notices:

+
  • You do not have to comply with the license for elements of the +material in the public domain or where your use is permitted by an +applicable exception or limitation.
  • +
  • No warranties are given. The license may not give you all of the +permissions necessary for your intended use. For example, other rights +such as publicity, privacy, or moral rights may limit how you use the +material.
  • +

Software +

+

Except where otherwise noted, the example programs and other software +provided by The Carpentries are made available under the OSI-approved MIT +license.

+

Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +“Software”), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions:

+

The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+

Trademark +

+

“The Carpentries”, “Software Carpentry”, “Data Carpentry”, and +“Library Carpentry” and their respective logos are registered trademarks +of Community Initiatives.

+
+
+ + +
+
+ + + diff --git a/instructor/aio.html b/instructor/aio.html new file mode 100644 index 0000000..0485b05 --- /dev/null +++ b/instructor/aio.html @@ -0,0 +1,2300 @@ + + + + + +Git for Official Statistics: All in One View + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+ + +

Content from Introduction

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 10 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • Why use version control in official statistics?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Identify uses and purposes for using Git in official statistics
  • +
+
+
+
+
+
+

Version Control in General + +

+
+

Version control is important whether you are working alone or +collaboratively, even if you are not working in statistics!

+

Here’s the basics of how a version control system works:

+
    +
  • start with a base version of a document
  • +
  • record changes made each step of the way
  • +
  • collaborators can add changes in independently without conflict
  • +
+
Web comic about sending a file back and forth using the file name as version control

You’ve probably already seen a version control system.

+

Good version control systems will allow you to see the history of a +project and will sync across different computers, facilitating +collaboration.

+
+
+ +
+
+

Version Control Systems +

+
+

What version control systems have you likely already come across? +List 1-2

+
+
+
+
+
+ +
+
+

You’ve probably seen Microsoft’s Track Changes and Google Doc’s +version history

+
+
+
+
+

Why Version Controlling Matters in Official Statistics + +

+
+

There are a number of reasons why version control matters matters in +official statistics:

+
    +
  1. Reproducibility: Within and across organizations, we need to be +able to reproduce statistics. This could be to ensure consistency in +methodology across reference periods, or check to see if statistics are +comparable in their methodologies.

  2. +
  3. Standardization: We can use version control systems as a single +source of truth to create standardization of statistics between and +within organizations.

  4. +
  5. Disseminate changes and updated versions: Following our single +source of truth, we can easily update and share changes to calculations +of official statistics as well as any new documentation or +methodologies. This means we are updating in one place rather than +many.

  6. +
  7. Collaboration: Version control systems allow us to collaborate +and connect on the creation of official statistics internally and +externally with stakeholders. We can use these systems to share proposed +changes, share work, and test code.

  8. +
  9. Efficient and Effective Development of Code: With a single source +of truth, we know exactly where to propose and find changes code that +makes our statistics. In addition, many version control systems have +project management or feedback tools that we can leverage to bundle +communication and discussion with the code itself rather than working in +multiple systems. This can allow for faster feedback and proposed +updates.

  10. +

Content from Version Control

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 10 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • What is Git?
  • +
  • Why should I use it?
  • +
  • How does it relate to open statistics?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Identify key concepts in version control and its use in official +statistics
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Setting up Git

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 5 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I set up Git?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Configure basic settings in Git
  • +
+
+
+
+
+
+

Before we start using Git for the first time on a new computer, there +are some things we need to set up. In this lesson, we will:

+
    +
  • Add a name and email address
  • +
  • Set the text editor used for writing commit messages
  • +
  • Understand the difference between --global and +--local configuration
  • +
  • View/confirm configuration settings
  • +
+

We will be using Git Bash, the command line interface for Git.

+

Configure Name and Email + +

+
+

An important first step in using Git is adding your name and email. +This information will be attached to commits, +branches, +and other changes you make in the future. This identifiability and +accountability for code changes is one of the key benefits to using +Git.

+

At the Git Bash prompt, enter the following, substituting your full +name for the name in quotation marks after user.name and +your email for the email address following user.email.

+
+

BASH +

+
$ git config --global user.name "Jane Doe"
+$ git config --global user.email "doe_jane@agency.gov"
+
+

Your situation may vary, but if you are writing code in your official +capacity and using an agency repository, you will most likely want to +use your official email address and the one associated with your account +on GitHub, GitLab, or other code sharing site.

+

Configure Text Editor + +

+
+
+

This is optional. By default, Git Bash will use the Vim text +editor.

+
+

There are many different Git clients and ways of interacting with Git +on your computer. Some clients have a full user interface that you use +for selecting files to stage for commits and authoring commit messages. +Others, like Git Bash, have a command line interface so when you want to +write a lengthy commit message, it needs to call up a text editor.

+
+
+ +
+
+

Different Ways to Author Commit Messages +

+
+

As you will learn in a +later lesson, once you make updates to your code, you will want to +make a snapshot of those updates called a commit and provide an +informative message that describes what was changed. This message can be +short and be written on the command line (e.g., +git commit -m "Update README.md"). Sometimes however, you +will want to write a longer, multi-line commit message. You can do this +by entering git commit on the command line. This will bring +up the text editor you have configured as your default.

+
+
+
+

The default text editor for Git Bash is Vim which has a reputation +for being difficult, especially for new users. So you may want to change +to something easier to use or something you are more familiar with +(e.g., your favorite text editor).

+

To switch to one of the following editors in the tables below, you +can use the associated configuration commands.

+

The nano text editor is packaged with Git Bash and Notepad is +included in the Windows operating system.

+ ++++ + + + + + + + + + + + + + + +
EditorConfiguration command
nano$ git config --global core.editor "nano -w"
Notepad (Win)$ git config --global core.editor "c:/Windows/System32/notepad.exe"
+

The text editors below are not available by default, but you may be +available to you. Setup for these is more complex because it requires +providing a filepath to the program executable which may not be the same +for everyone.

+ ++++ + + + + + + + + + + + + + + + + + + +
EditorConfiguration command
Notepad++ (Win, 64-bit install)$ git config --global core.editor "'c:/program files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Sublime Text (Win, 64-bit install)$ git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
VS Code$ git config --global core.editor "code --wait"
+

If you ever want to switch back to Vim as the default, you can run +the following command.

+ ++++ + + + + + + + + +
EditorConfiguration command
Vim$ git config --global core.editor "vim"
+
+
+ +
+
+

Exiting Vim +

+
+

Vim is surprisingly difficult to exit from. If you wish to exit a +session without saving your changes, press Esc then type +:q! and hit Enter or . If you want +to save your changes and quit, press Esc then type +:wq and hit Enter or .

+
+
+
+

+--global vs. --local + +

+
+

In the code samples above, we have used the --global +flag. These are the settings Git will use for all repositories on your +computer. As your use of Git becomes more complex, you may wish to have +different configuration settings for different repositories. This is +when you might use the --local flag. --local +allows you to set configuration for specific repositories.

+

To set local configuration, open Git Bash and navigate to the +repository you want to configure. You can then use the commands above, +but substitute --local for --global.

+

For example, if you want to set a different name or email address for +a specific project, you can do so with commands like those below.

+
+

BASH +

+
$ git config --local user.name "Jane R Doe"
+$ git config --local user.email "janedoe@example.com"
+
+

These settings will override the --global configuration +settings for that repository only.

+

View/Confirm Configuration + +

+
+

You may wish to check your configuration settings.

+

To see all configuration settings, you can use the following command. +If you are in a repository, this will show all global and local +configuration settings.

+
+

BASH +

+
$ git config --list
+
+

To view global settings only (Note: This command can be run +anywhere):

+
+

BASH +

+
$ git config --global --list
+
+

To view local settings only (Note: This has to be run while +in a repository):

+
+

BASH +

+
$ git config --local --list
+
+

To view specific settings, include the setting name. For example, to +view the email address configuration setting:

+
+

BASH +

+
$ git config user.email 
+
+

Other Configuration Settings + +

+
+

There are other, optional configuration settings you may wish to +change. Review Git documentation and consult with others on your team +about other settings.

+
+
+ +
+
+

Key Points +

+
+
    +
  • Use git config with the --global option to +configure a user name, email address, editor, and other preferences once +per machine.
  • +
  • Use --local in place of --global within a +repository to set repository specific changes.
  • +
+
+
+
+

Content from Creating a Repository

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 10 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • Where does Git store information?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Create a repository in a local folder
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Tracking Changes

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 20 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I record changes in Git?
  • +
  • How do I check the status of my version control repository?
  • +
  • How do I record notes about what changes I made and why?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Check the history of a file
  • +
  • Use add and commit to record changes
  • +
  • Create commit messages that are descriptive
  • +
+
+
+
+
+
+

Note This lesson has been adapted from Lesson 4 +of Version Control with Git

+

Getting Started + +

+
+

First let’s make sure we’re still in the right directory. You should +be in the planets directory.

+
+

BASH +

+
$ cd ~/Desktop/planets
+
+

Let’s create a file called mars.txt that contains some +notes about the Red Planet’s suitability as a base. We’ll use +nano to edit the file; you can use whatever editor you +like. In particular, this does not have to be the +core.editor you set globally earlier. But remember, the +bash command to create or edit a new file will depend on the editor you +choose (it might not be nano). For a refresher on text +editors, check out “Which +Editor?” in The Unix Shell +lesson.

+
+

BASH +

+
$ nano mars.txt
+
+

Type the text below into the mars.txt file:

+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

Let’s first verify that the file was properly created by running the +list command (ls):

+
+

BASH +

+
$ ls
+
+
+

OUTPUT +

+
mars.txt
+
+

mars.txt contains a single line, which we can see by +running:

+
+

BASH +

+
$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+
+

If we check the status of our project again, Git tells us that it’s +noticed the new file:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Untracked files:
+   (use "git add <file>..." to include in what will be committed)
+
+	mars.txt
+
+nothing added to commit but untracked files present (use "git add" to track)
+
+

The “untracked files” message means that there’s a file in the +directory that Git isn’t keeping track of. We can tell Git to track a +file using git add:

+
+

BASH +

+
$ git add mars.txt
+
+

and then check that the right thing happened:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+
+No commits yet
+
+Changes to be committed:
+  (use "git rm --cached <file>..." to unstage)
+
+	new file:   mars.txt
+
+
+

Git now knows that it’s supposed to keep track of +mars.txt, but it hasn’t recorded these changes as a commit +yet. To get it to do that, we need to run one more command:

+
+

BASH +

+
$ git commit -m "Start notes on Mars as a base"
+
+
+

OUTPUT +

+
[main (root-commit) f22b25e] Start notes on Mars as a base
+ 1 file changed, 1 insertion(+)
+ create mode 100644 mars.txt
+
+

When we run git commit, Git takes everything we have +told it to save by using git add and stores a copy +permanently inside the special .git directory. This +permanent copy is called a commit +(or revision) and its short +identifier is f22b25e. Your commit may have another +identifier.

+

We use the -m flag (for “message”) to record a short, +descriptive, and specific comment that will help us remember later on +what we did and why. If we just run git commit without the +-m option, Git will launch nano (or whatever +other editor we configured as core.editor) so that we can +write a longer message.

+

[Good commit messages][commit-messages] start with a brief (<50 +characters) statement about the changes made in the commit. Generally, +the message should complete the sentence “If applied, this commit will” +. If you want to go into more detail, add a blank +line between the summary line and your additional notes. Use this +additional space to explain why you made changes and/or what their +impact will be.

+

If we run git status now:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

it tells us everything is up to date. If we want to know what we’ve +done recently, we can ask Git to show us the project’s history using +git log:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+

git log lists all commits made to a repository in +reverse chronological order. The listing for each commit includes the +commit’s full identifier (which starts with the same characters as the +short identifier printed by the git commit command +earlier), the commit’s author, when it was created, and the log message +Git was given when the commit was created.

+
+
+ +
+
+

Where Are My Changes? +

+
+

If we run ls at this point, we will still see just one +file called mars.txt. That’s because Git saves information +about files’ history in the special .git directory +mentioned earlier so that our filesystem doesn’t become cluttered (and +so that we can’t accidentally edit or delete an old version).

+
+
+
+

Now suppose Dracula adds more information to the file. (Again, we’ll +edit with nano and then cat the file to show +its contents; you may use a different editor, and don’t need to +cat.)

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+
+

When we run git status now, it tells us that a file it +already knows about has been modified:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

The last line is the key phrase: “no changes added to commit”. We +have changed this file, but we haven’t told Git we will want to save +those changes (which we do with git add) nor have we saved +them (which we do with git commit). So let’s do that now. +It is good practice to always review our changes before saving them. We +do this using git diff. This shows us the differences +between the current state of the file and the most recently saved +version:

+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index df0654a..315bf3a 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1 +1,2 @@
+ Cold and dry, but everything is my favorite color
++The two moons may be a problem for Wolfman
+
+

The output is cryptic because it is actually a series of commands for +tools like editors and patch telling them how to +reconstruct one file given the other. If we break it down into +pieces:

+
    +
  1. The first line tells us that Git is producing output similar to the +Unix diff command comparing the old and new versions of the +file.
  2. +
  3. The second line tells exactly which versions of the file Git is +comparing; df0654a and 315bf3a are unique +computer-generated labels for those versions.
  4. +
  5. The third and fourth lines once again show the name of the file +being changed.
  6. +
  7. The remaining lines are the most interesting, they show us the +actual differences and the lines on which they occur. In particular, the ++ marker in the first column shows where we added a +line.
  8. +
+

After reviewing our change, it’s time to commit it:

+
+

BASH +

+
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
On branch main
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git checkout -- <file>..." to discard changes in working directory)
+
+	modified:   mars.txt
+
+no changes added to commit (use "git add" and/or "git commit -a")
+
+

Whoops: Git won’t commit because we didn’t use git add +first. Let’s fix that:

+
+

BASH +

+
$ git add mars.txt
+$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
+
+
+

OUTPUT +

+
[main 34961b1] Add concerns about effects of Mars' moons on Wolfman
+ 1 file changed, 1 insertion(+)
+
+

Git insists that we add files to the set we want to commit before +actually committing anything. This allows us to commit our changes in +stages and capture changes in logical portions rather than only large +batches. For example, suppose we’re adding a few citations to relevant +research to our thesis. We might want to commit those additions, and the +corresponding bibliography entries, but not commit some of our +work drafting the conclusion (which we haven’t finished yet).

+

To allow for this, Git has a special staging area where it +keeps track of things that have been added to the current changeset but not yet committed.

+
+
+ +
+
+

Staging Area +

+
+

If you think of Git as taking snapshots of changes over the life of a +project, git add specifies what will go in a +snapshot (putting things in the staging area), and +git commit then actually takes the snapshot, and +makes a permanent record of it (as a commit). If you don’t have anything +staged when you type git commit, Git will prompt you to use +git commit -a or git commit --all, which is +kind of like gathering everyone to take a group photo! However, +it’s almost always better to explicitly add things to the staging area, +because you might commit changes you forgot you made. (Going back to the +group photo simile, you might get an extra with incomplete makeup +walking on the stage for the picture because you used +-a!).

+

In the context of creating official statistics, using +--all or -a can lead to files being staged and +committed that should not be released (like microdata) or can cause +difficulties for others on the project (like environment files).

+

Staging things manually or using a pattern is the best practice, +otherwise you might find yourself searching for “git undo commit” more +than you would like!

+

Remember to use git status after you add files to check +what you have staged/added.

+
+
+
+
The Git Staging Area

Let’s watch as our changes to a file move from our editor to the +staging area and into long-term storage. First, we’ll add another line +to the file:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
+But the Mummy will appreciate the lack of humidity
+
+
+

BASH +

+
$ git diff
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

So far, so good: we’ve added one line to the end of the file (shown +with a + in the first column). Now let’s put that change in +the staging area and see what git diff reports:

+
+

BASH +

+
$ git add mars.txt
+$ git diff
+
+

There is no output: as far as Git can tell, there’s no difference +between what it’s been asked to save permanently and what’s currently in +the directory. However, if we do this:

+
+

BASH +

+
$ git diff --staged
+
+
+

OUTPUT +

+
diff --git a/mars.txt b/mars.txt
+index 315bf3a..b36abfd 100644
+--- a/mars.txt
++++ b/mars.txt
+@@ -1,2 +1,3 @@
+ Cold and dry, but everything is my favorite color
+ The two moons may be a problem for Wolfman
++But the Mummy will appreciate the lack of humidity
+
+

it shows us the difference between the last committed change and +what’s in the staging area. Let’s save our changes:

+
+

BASH +

+
$ git commit -m "Discuss concerns about Mars' climate for Mummy"
+
+
+

OUTPUT +

+
[main 005937f] Discuss concerns about Mars' climate for Mummy
+ 1 file changed, 1 insertion(+)
+
+

check our status:

+
+

BASH +

+
$ git status
+
+
+

OUTPUT +

+
On branch main
+nothing to commit, working tree clean
+
+

and look at the history of what we’ve done so far:

+
+

BASH +

+
$ git log
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+    Discuss concerns about Mars' climate for Mummy
+
+commit 34961b159c27df3b475cfe4415d94a6d1fcd064d
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:07:21 2013 -0400
+
+    Add concerns about effects of Mars' moons on Wolfman
+
+commit f22b25e3233b4645dabd0d81e651fe074bd8e73b
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 09:51:46 2013 -0400
+
+    Start notes on Mars as a base
+
+
+
+ +
+
+

Word-based diffing +

+
+

Sometimes, e.g. in the case of the text documents a line-wise diff is +too coarse. That is where the --color-words option of +git diff comes in very useful as it highlights the changed +words using colors.

+
+
+
+
+
+ +
+
+

Paging the Log +

+
+

When the output of git log is too long to fit in your +screen, git uses a program to split it into pages of the +size of your screen. When this “pager” is called, you will notice that +the last line in your screen is a :, instead of your usual +prompt.

+
    +
  • To get out of the pager, press Q.
  • +
  • To move to the next page, press Spacebar.
  • +
  • To search for some_word in all pages, press +/ and type some_word. Navigate through matches +pressing N.
  • +
+
+
+
+
+
+ +
+
+

Limit Log Size +

+
+

To avoid having git log cover your entire terminal +screen, you can limit the number of commits that Git lists by using +-N, where N is the number of commits that you +want to view. For example, if you only want information from the last +commit you can use:

+
+

BASH +

+
$ git log -1
+
+
+

OUTPUT +

+
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5 (HEAD -> main)
+Author: Vlad Dracula <vlad@tran.sylvan.ia>
+Date:   Thu Aug 22 10:14:07 2013 -0400
+
+   Discuss concerns about Mars' climate for Mummy
+
+

You can also reduce the quantity of information using the +--oneline option:

+
+

BASH +

+
$ git log --oneline
+
+
+

OUTPUT +

+
005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+34961b1 Add concerns about effects of Mars' moons on Wolfman
+f22b25e Start notes on Mars as a base
+
+

You can also combine the --oneline option with others. +One useful combination adds --graph to display the commit +history as a text-based graph and to indicate which commits are +associated with the current HEAD, the current branch +main, or [other Git references][git-references]:

+
+

BASH +

+
$ git log --oneline --graph
+
+
+

OUTPUT +

+
* 005937f (HEAD -> main) Discuss concerns about Mars' climate for Mummy
+* 34961b1 Add concerns about effects of Mars' moons on Wolfman
+* f22b25e Start notes on Mars as a base
+
+
+
+
+
+
+ +
+
+

Directories +

+
+

Two important facts you should know about directories in Git.

+
    +
  1. Git does not track directories on their own, only files within them. +Try it for yourself:
  2. +
+
+

BASH +

+
$ mkdir spaceships
+$ git status
+$ git add spaceships
+$ git status
+
+

Note, our newly created empty directory spaceships does +not appear in the list of untracked files even if we explicitly add it +(via git add) to our repository. This is the +reason why you will sometimes see .gitkeep files in +otherwise empty directories. Unlike .gitignore, these files +are not special and their sole purpose is to populate a directory so +that Git adds it to the repository. In fact, you can name such files +anything you like.

+
    +
  1. If you create a directory in your Git repository and populate it +with files, you can add all files in the directory at once by:
  2. +
+
+

BASH +

+
git add <directory-with-files>
+
+

Try it for yourself:

+
+

BASH +

+
$ touch spaceships/apollo-11 spaceships/sputnik-1
+$ git status
+$ git add spaceships
+$ git status
+
+

Before moving on, we will commit these changes.

+
+

BASH +

+
$ git commit -m "Add some initial thoughts on spaceships"
+
+
+
+
+

To recap, when we want to add changes to our repository, we first +need to add the changed files to the staging area (git add) +and then commit the staged changes to the repository +(git commit):

+
The Git Commit Workflow
+
+ +
+
+

Choosing a Commit Message +

+
+

Which of the following commit messages would be most appropriate for +the last commit made to mars.txt?

+
    +
  1. “Changes”
  2. +
  3. “Added line ‘But the Mummy will appreciate the lack of humidity’ to +mars.txt”
  4. +
  5. “Discuss effects of Mars’ climate on the Mummy”
  6. +
+
+
+
+
+
+ +
+
+

Answer 1 is not descriptive enough, and the purpose of the commit is +unclear; and answer 2 is redundant to using “git diff” to see what +changed in this commit; but answer 3 is good: short, descriptive, and +imperative.

+
+
+
+
+
+
+ +
+
+

Committing Changes to Git +

+
+

Which command(s) below would save the changes of +myfile.txt to my local Git repository?

+
    +
  1. +

    BASH +

    +
      $ git commit -m "my recent changes"
    +
  2. +
  3. +

    BASH +

    +
      $ git init myfile.txt
    +  $ git commit -m "my recent changes"
    +
  4. +
  5. +

    BASH +

    +
      $ git add myfile.txt
    +  $ git commit -m "my recent changes"
    +
  6. +
  7. +

    BASH +

    +
      $ git commit -m myfile.txt "my recent changes"
    +
  8. +
+
+
+
+
+
+ +
+
+
    +
  1. Would only create a commit if files have already been staged.
  2. +
  3. Would try to create a new repository.
  4. +
  5. Is correct: first add the file to the staging area, then +commit.
  6. +
  7. Would try to commit a file “my recent changes” with the message +myfile.txt.
  8. +
+
+
+
+
+
+
+ +
+
+

Committing Multiple Files +

+
+

The staging area can hold changes from any number of files that you +want to commit as a single snapshot.

+
    +
  1. Add some text to mars.txt noting your decision to +consider Venus as a base
  2. +
  3. Create a new file venus.txt with your initial thoughts +about Venus as a base for you and your friends
  4. +
  5. Add changes from both files to the staging area, and commit those +changes.
  6. +
+
+
+
+
+
+ +
+
+

The output below from cat mars.txt reflects only content +added during this exercise. Your output may vary.

+

First we make our changes to the mars.txt and +venus.txt files:

+
+

BASH +

+
$ nano mars.txt
+$ cat mars.txt
+
+
+

OUTPUT +

+
Maybe I should start with a base on Venus.
+
+
+

BASH +

+
$ nano venus.txt
+$ cat venus.txt
+
+
+

OUTPUT +

+
Venus is a nice planet and I definitely should consider it as a base.
+
+

Now you can add both files to the staging area. We can do that in one +line:

+
+

BASH +

+
$ git add mars.txt venus.txt
+
+

Or with multiple commands:

+
+

BASH +

+
$ git add mars.txt
+$ git add venus.txt
+
+

Now the files are ready to commit. You can check that using +git status. If you are ready to commit use:

+
+

BASH +

+
$ git commit -m "Write plans to start a base on Venus"
+
+
+

OUTPUT +

+
[main cc127c2]
+ Write plans to start a base on Venus
+ 2 files changed, 2 insertions(+)
+ create mode 100644 venus.txt
+
+
+
+
+
+
+
+ +
+
+

+bio Repository +

+
+
    +
  • Create a new Git repository on your computer called +bio.
  • +
  • Write a three-line biography for yourself in a file called +me.txt, commit your changes
  • +
  • Modify one line, add a fourth line
  • +
  • Display the differences between its updated state and its original +state.
  • +
+
+
+
+
+
+ +
+
+

If needed, move out of the planets folder:

+
+

BASH +

+
$ cd ..
+
+

Create a new folder called bio and ‘move’ into it:

+
+

BASH +

+
$ mkdir bio
+$ cd bio
+
+

Initialise git:

+
+

BASH +

+
$ git init
+
+

Create your biography file me.txt using +nano or another text editor. Once in place, add and commit +it to the repository:

+
+

BASH +

+
$ git add me.txt
+$ git commit -m "Add biography file" 
+
+

Modify the file as described (modify one line, add a fourth line). To +display the differences between its updated state and its original +state, use git diff:

+
+

BASH +

+
$ git diff me.txt
+
+
+
+
+
+

Content from Exploring History

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 25 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I identify old versions of files?
  • +
  • How do I review my changes?
  • +
  • How can I recover old versions of files?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • view commit history of a file
  • +
  • checkout an older version of a file
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Ignoring Things

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 10 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I tell Git to ignore files I don’t want to track?
  • +
  • What do we have to watch for when creating official statistics?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • create a .gitignore
  • +
  • identify file types and areas of risk for official statistics
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Remotes in GitLab/GitHub

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 45 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I share my changes with others on the web?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Connect Git to a remote repository
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Collaborating

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 35 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I use version control to collaborate with other people?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Use Git and branches to work with others locally
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Conflicts

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 15 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • What do I do when my changes conflict with someone else’s?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Resolve a merge conflict
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Working with Others in GitHub/GitLab

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 20 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I put work on the protected branch?
  • +
  • How can we keep track of what needs to be done?
  • +
  • How can I add collaborators?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Add collaborators to a remote repository
  • +
  • use issues to keep track of project needs
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Documenting in GitHub/GitLab for official statistics

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 10 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How do I create documentation so others can understand my +methodology?
  • +
  • How can I host it easily on GitHub?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • Create documentation using markdown
  • +
  • add links and images to documentation
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+

Content from Citation

+
+

Last updated on 2024-07-11 | + + Edit this page

+

Estimated time: 5 minutes

+
+ +
+
+

Overview

+
+
+
+
+

Questions

+
    +
  • How can I make my work easier to cite?
  • +
+
+
+
+
+
+
+

Objectives

+
    +
  • How to cite and be cited
  • +
+
+
+
+
+
+

Welcome to using Git in Official Statistics!

+
+
+ +
+
+

Key Points +

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+
+
+
+
+ + +
+ + +
+ + + + + diff --git a/instructor/discuss.html b/instructor/discuss.html new file mode 100644 index 0000000..03f9933 --- /dev/null +++ b/instructor/discuss.html @@ -0,0 +1,478 @@ + +Git for Official Statistics: Discussion +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Discussion

+

Last updated on 2024-07-11 | + + Edit this page

+ + + + + +
+ +
+ + +

FIXME

+ + +
+
+ + +
+
+ + + diff --git a/instructor/images.html b/instructor/images.html new file mode 100644 index 0000000..ff31229 --- /dev/null +++ b/instructor/images.html @@ -0,0 +1,552 @@ + + + + + +Git for Official Statistics: All Images + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+ + +

Introduction

+
+

Figure 1

+ +
Web comic about sending a file back and forth using the file name as version control

Version Control

+

Setting up Git

+

Creating a Repository

+

Tracking Changes

+
+

Figure 1

+ +
The Git Staging Area

+

Figure 2

+ +
The Git Commit Workflow

Exploring History

+

Ignoring Things

+

Remotes in GitLab/GitHub

+

Collaborating

+

Conflicts

+

Working with Others in GitHub/GitLab

+

Documenting in GitHub/GitLab for official statistics

+

Citation

+
+
+
+
+ + +
+ + +
+ + + + + diff --git a/instructor/index.html b/instructor/index.html new file mode 100644 index 0000000..7efce79 --- /dev/null +++ b/instructor/index.html @@ -0,0 +1,642 @@ + +Git for Official Statistics: Summary and Schedule +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+

Summary and Schedule

+ + +

Project Introduction +

+

Git for Official Statistics is part of the UNECE HLG-MOS ModernStats +Carpentries project. This is one out of a series of lessons that have +been modified from Software Carpentries to meet the needs of +organizations producing official statistics as they upskill their +workforces.

+

Git for official statistics is intended for beginners to novices. +This lesson is designed to introduce the basics of using Git while +working with others. Additionally, this lesson covers best practices for +using Git in the context of official statistics.

+

There are plans to translate this lesson into French following the +completion of the content in English. Official statistics organizations +and community members are welcome and encouraged to translate the +contents of the lesson into additional languages to meet their +needs.

+

If you are interested in running a session, please feel free to +contact the owners on the project through the repository for this +lesson

+

Notes on using this lesson +

+

This lesson is designed to be modular, allowing for instructors to +select and deliver chapters to their audiences as needed. For senior +managers, managers, and low-code environment employees, a minimum of +chapter 1 is recommended. Employees in low-code environments may need +additional chapters depending on what actions they will be doing with +Git.

+

This lesson is designed to be ~4 hours of content delivered over 6 +hours with breaks to reduce cognitive load on participants instructors. +It can be delivered digitally and in-person.

+

Following the Carpentries model, it is recommended this training be +delivered synchronously, and not recorded.

+
+
+ +
+
+

Prerequisites +

+
+

Installation of Git and a GitHub account.

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor. +

+

FIXME

+ +
+ + +
+
+ + + diff --git a/instructor/instructor-notes.html b/instructor/instructor-notes.html new file mode 100644 index 0000000..57f83a7 --- /dev/null +++ b/instructor/instructor-notes.html @@ -0,0 +1,545 @@ + + + + + +Git for Official Statistics: Instructor Notes + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + + + + +
+ + +
+ + + + + diff --git a/instructor/key-points.html b/instructor/key-points.html new file mode 100644 index 0000000..c626391 --- /dev/null +++ b/instructor/key-points.html @@ -0,0 +1,580 @@ + + + + + +Git for Official Statistics: Key Points + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+ + +

Introduction

+

Version Control

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Setting up Git

+
+
    +
  • Use git config with the --global option to +configure a user name, email address, editor, and other preferences once +per machine.
  • +
  • Use --local in place of --global within a +repository to set repository specific changes.
  • +

Creating a Repository

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Tracking Changes

+

Exploring History

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Ignoring Things

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Remotes in GitLab/GitHub

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Collaborating

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Conflicts

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Working with Others in GitHub/GitLab

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Documenting in GitHub/GitLab for official statistics

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Citation

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+
+ + +
+ + +
+ + + + + diff --git a/instructor/profiles.html b/instructor/profiles.html new file mode 100644 index 0000000..8639730 --- /dev/null +++ b/instructor/profiles.html @@ -0,0 +1,435 @@ + +Git for Official Statistics: Learner Profiles +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Learner Profiles

+ +

This is a placeholder file. Please add content here.

+ +
+
+ + +
+
+ + + diff --git a/instructor/reference.html b/instructor/reference.html new file mode 100644 index 0000000..eba38d3 --- /dev/null +++ b/instructor/reference.html @@ -0,0 +1,478 @@ + +Git for Official Statistics: Glossary +
+ Git for Official Statistics +
+ +
+
+ + + + + +
+
+

Glossary

+

Last updated on 2024-07-11 | + + Edit this page

+ + + + + +
+ +
+ + +

Glossary +

+

FIXME

+
+
+ + +
+
+ + + diff --git a/key-points.html b/key-points.html new file mode 100644 index 0000000..93b92ed --- /dev/null +++ b/key-points.html @@ -0,0 +1,578 @@ + + + + + +Git for Official Statistics: Key Points + + + + + + + + + + + + +
+ Git for Official Statistics +
+ +
+
+ + + + + + +
+
+ + +

Introduction

+

Version Control

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Setting up Git

+
+
    +
  • Use git config with the --global option to +configure a user name, email address, editor, and other preferences once +per machine.
  • +
  • Use --local in place of --global within a +repository to set repository specific changes.
  • +

Creating a Repository

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Tracking Changes

+

Exploring History

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Ignoring Things

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Remotes in GitLab/GitHub

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Collaborating

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Conflicts

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Working with Others in GitHub/GitLab

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Documenting in GitHub/GitLab for official statistics

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +

Citation

+
+
    +
  • First key point. Brief Answer to questions. (FIXME)
  • +
+
+
+
+ + +
+ + +
+ + + + + diff --git a/link.svg b/link.svg new file mode 100644 index 0000000..88ad827 --- /dev/null +++ b/link.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/md5sum.txt b/md5sum.txt new file mode 100644 index 0000000..2aeb5e6 --- /dev/null +++ b/md5sum.txt @@ -0,0 +1,23 @@ +"file" "checksum" "built" "date" +"CODE_OF_CONDUCT.md" "c93c83c630db2fe2462240bf72552548" "site/built/CODE_OF_CONDUCT.md" "2024-07-11" +"LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2024-07-11" +"config.yaml" "b7dd5800ce694b73db973230069991cd" "site/built/config.yaml" "2024-07-11" +"index.md" "4b839f2ba9b81aba2c6575a8ef02c65e" "site/built/index.md" "2024-07-11" +"episodes/01-introduction.md" "f8a44b87510cc6aa463120452eafce78" "site/built/01-introduction.md" "2024-07-11" +"episodes/02-version_control.md" "c18adbde35d3df56412f61f7e71e2c8d" "site/built/02-version_control.md" "2024-07-11" +"episodes/03-git_setup.md" "95f47db1d8dcd66a6e1d00116b68df79" "site/built/03-git_setup.md" "2024-07-11" +"episodes/04-create_repo.md" "dd0fa71dd488d86059c9b8e645d2e2da" "site/built/04-create_repo.md" "2024-07-11" +"episodes/05-track_changes.md" "cc122a8a0e9749a27c95d75fb8c5e759" "site/built/05-track_changes.md" "2024-07-11" +"episodes/06-exploring_history.md" "41f1842579b353389cc3ade97ffeb4b7" "site/built/06-exploring_history.md" "2024-07-11" +"episodes/07-ignoring_things.md" "c455986ef09c5a8787364a646a76fd02" "site/built/07-ignoring_things.md" "2024-07-11" +"episodes/08-remotes.md" "526025e329f1678ee4a850827acc5457" "site/built/08-remotes.md" "2024-07-11" +"episodes/09-collaborating.md" "22e1a09f397ae643d66efaed3f5f5058" "site/built/09-collaborating.md" "2024-07-11" +"episodes/10-conflicts.md" "57e164562de6395d41ac481522e7badd" "site/built/10-conflicts.md" "2024-07-11" +"episodes/11-working_remotes.md" "05a71e88e8f2d46eabe6bda121ae9910" "site/built/11-working_remotes.md" "2024-07-11" +"episodes/12-documentation.md" "da015f5a9cf013dc9904e4e61cc10c3f" "site/built/12-documentation.md" "2024-07-11" +"episodes/13-citation.md" "84e63cb4938a57738788bbf5354f4fd8" "site/built/13-citation.md" "2024-07-11" +"instructors/instructor-notes.md" "a59fd3b94c07c3fe3218c054a0f03277" "site/built/instructor-notes.md" "2024-07-11" +"learners/discuss.md" "2758e2e5abd231d82d25c6453d8abbc6" "site/built/discuss.md" "2024-07-11" +"learners/reference.md" "28853696c21dd22dfb883e9c241e95fb" "site/built/reference.md" "2024-07-11" +"learners/setup.md" "ac87d318cb43bd0279662183e274fea5" "site/built/setup.md" "2024-07-11" +"profiles/learner-profiles.md" "60b93493cf1da06dfd63255d73854461" "site/built/learner-profiles.md" "2024-07-11" diff --git a/mstile-150x150.png b/mstile-150x150.png new file mode 100644 index 0000000..8136f75 Binary files /dev/null and b/mstile-150x150.png differ diff --git a/pkgdown.css b/pkgdown.css new file mode 100644 index 0000000..80ea5b8 --- /dev/null +++ b/pkgdown.css @@ -0,0 +1,384 @@ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body { + position: relative; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; +} + +body > .container .row { + flex: 1 0 auto; +} + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; +} +footer p { + margin-bottom: 0; +} +footer div { + flex: 1; +} +footer .pkgdown { + text-align: right; +} +footer p { + margin-bottom: 0; +} + +img.icon { + float: right; +} + +/* Ensure in-page images don't run outside their container */ +.contents img { + max-width: 100%; + height: auto; +} + +/* Fix bug in bootstrap (only seen in firefox) */ +summary { + display: list-item; +} + +/* Typographic tweaking ---------------------------------*/ + +.contents .page-header { + margin-top: calc(-60px + 1em); +} + +dd { + margin-left: 3em; +} + +/* Section anchors ---------------------------------*/ + +a.anchor { + display: none; + margin-left: 5px; + width: 20px; + height: 20px; + + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; +} + +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-block; +} + +/* Fixes for fixed navbar --------------------------*/ + +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; +} + +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; +} + +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} + +/* Sidebar --------------------------*/ + +#pkgdown-sidebar { + margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; +} + +#pkgdown-sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} + +#pkgdown-sidebar h2:first-child { + margin-top: 0; +} + +#pkgdown-sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + +.orcid { + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; + vertical-align: middle; +} + +/* Reference index & topics ----------------------------------------------- */ + +.ref-index th {font-weight: normal;} + +.ref-index td {vertical-align: top; min-width: 100px} +.ref-index .icon {width: 40px;} +.ref-index .alias {width: 40%;} +.ref-index-icons .alias {width: calc(40% - 40px);} +.ref-index .title {width: 60%;} + +.ref-arguments th {text-align: right; padding-right: 10px;} +.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} + +/* Nice scrolling for wide elements --------------------------------------- */ + +table { + display: block; + overflow: auto; +} + +/* Syntax highlighting ---------------------------------------------------- */ + +pre, code, pre code { + background-color: #f8f8f8; + color: #333; +} +pre, pre code { + white-space: pre-wrap; + word-break: break-all; + overflow-wrap: break-word; +} + +pre { + border: 1px solid #eee; +} + +pre .img, pre .r-plt { + margin: 5px 0; +} + +pre .img img, pre .r-plt img { + background-color: #fff; +} + +code a, pre a { + color: #375f84; +} + +a.sourceLine:hover { + text-decoration: none; +} + +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.error {font-weight: bolder;} +.warning {font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; +} + +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; +} + +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; +} + +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; +} + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} + +/* Section anchors --------------------------------- + Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 +*/ + +div.csl-bib-body { } +div.csl-entry { + clear: both; +} +.hanging-indent div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} diff --git a/pkgdown.js b/pkgdown.js new file mode 100644 index 0000000..6f0eee4 --- /dev/null +++ b/pkgdown.js @@ -0,0 +1,108 @@ +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $('.navbar-fixed-top').headroom(); + + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); + }); + + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); + + var length = prefix_length(nav_path, cur_path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + // Returns -1 if not found + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(-1); + + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 0 : -1); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } + + /* Clipboard --------------------------*/ + + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); + } + + if(ClipboardJS.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $("div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/pkgdown.yml b/pkgdown.yml new file mode 100644 index 0000000..a2b9611 --- /dev/null +++ b/pkgdown.yml @@ -0,0 +1,5 @@ +pandoc: 3.1.11 +pkgdown: 2.1.0 +pkgdown_sha: ~ +articles: {} +last_built: 2024-07-11T13:20Z diff --git a/profiles.html b/profiles.html new file mode 100644 index 0000000..c9a2948 --- /dev/null +++ b/profiles.html @@ -0,0 +1,435 @@ + +Git for Official Statistics: Learner Profiles +
    + Git for Official Statistics +
    + +
    +
    + + + + + +
    +
    +

    Learner Profiles

    + +

    This is a placeholder file. Please add content here.

    + +
    +
    + + +
    +
    + + + diff --git a/reference.html b/reference.html new file mode 100644 index 0000000..744563c --- /dev/null +++ b/reference.html @@ -0,0 +1,476 @@ + +Git for Official Statistics: Glossary +
    + Git for Official Statistics +
    + +
    +
    + + + + + +
    +
    +

    Glossary

    +

    Last updated on 2024-07-11 | + + Edit this page

    + + + +
    + +
    + + +

    Glossary +

    +

    FIXME

    +
    +
    + + +
    +
    + + + diff --git a/safari-pinned-tab.svg b/safari-pinned-tab.svg new file mode 100644 index 0000000..8a74e60 --- /dev/null +++ b/safari-pinned-tab.svg @@ -0,0 +1,68 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + + + + diff --git a/site.webmanifest b/site.webmanifest new file mode 100644 index 0000000..f2302ff --- /dev/null +++ b/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "The Carpentries", + "short_name": "The Carpentries", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..e5317c2 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,123 @@ + + + + https://UNECE.github.io/ModernStats_Git/01-introduction.html + + + https://UNECE.github.io/ModernStats_Git/02-version_control.html + + + https://UNECE.github.io/ModernStats_Git/03-git_setup.html + + + https://UNECE.github.io/ModernStats_Git/04-create_repo.html + + + https://UNECE.github.io/ModernStats_Git/05-track_changes.html + + + https://UNECE.github.io/ModernStats_Git/06-exploring_history.html + + + https://UNECE.github.io/ModernStats_Git/07-ignoring_things.html + + + https://UNECE.github.io/ModernStats_Git/08-remotes.html + + + https://UNECE.github.io/ModernStats_Git/09-collaborating.html + + + https://UNECE.github.io/ModernStats_Git/10-conflicts.html + + + https://UNECE.github.io/ModernStats_Git/11-working_remotes.html + + + https://UNECE.github.io/ModernStats_Git/12-documentation.html + + + https://UNECE.github.io/ModernStats_Git/13-citation.html + + + https://UNECE.github.io/ModernStats_Git/404.html + + + https://UNECE.github.io/ModernStats_Git/CODE_OF_CONDUCT.html + + + https://UNECE.github.io/ModernStats_Git/LICENSE.html + + + https://UNECE.github.io/ModernStats_Git/discuss.html + + + https://UNECE.github.io/ModernStats_Git/index.html + + + https://UNECE.github.io/ModernStats_Git/instructor/01-introduction.html + + + https://UNECE.github.io/ModernStats_Git/instructor/02-version_control.html + + + https://UNECE.github.io/ModernStats_Git/instructor/03-git_setup.html + + + https://UNECE.github.io/ModernStats_Git/instructor/04-create_repo.html + + + https://UNECE.github.io/ModernStats_Git/instructor/05-track_changes.html + + + https://UNECE.github.io/ModernStats_Git/instructor/06-exploring_history.html + + + https://UNECE.github.io/ModernStats_Git/instructor/07-ignoring_things.html + + + https://UNECE.github.io/ModernStats_Git/instructor/08-remotes.html + + + https://UNECE.github.io/ModernStats_Git/instructor/09-collaborating.html + + + https://UNECE.github.io/ModernStats_Git/instructor/10-conflicts.html + + + https://UNECE.github.io/ModernStats_Git/instructor/11-working_remotes.html + + + https://UNECE.github.io/ModernStats_Git/instructor/12-documentation.html + + + https://UNECE.github.io/ModernStats_Git/instructor/13-citation.html + + + https://UNECE.github.io/ModernStats_Git/instructor/404.html + + + https://UNECE.github.io/ModernStats_Git/instructor/CODE_OF_CONDUCT.html + + + https://UNECE.github.io/ModernStats_Git/instructor/LICENSE.html + + + https://UNECE.github.io/ModernStats_Git/instructor/discuss.html + + + https://UNECE.github.io/ModernStats_Git/instructor/index.html + + + https://UNECE.github.io/ModernStats_Git/instructor/profiles.html + + + https://UNECE.github.io/ModernStats_Git/instructor/reference.html + + + https://UNECE.github.io/ModernStats_Git/profiles.html + + + https://UNECE.github.io/ModernStats_Git/reference.html + +