├── docs
└── README.txt
├── .DS_Store
├── data
├── gss.dta
├── example_files.zip
├── Anscombes_quartet.pdf
├── Anscombes_quartet.png
├── Sailfish_manual.docx
├── Anscombes quartet - Wikipedia.pdf
├── 5 Ways to Calculate Pi - wikiHow.pdf
├── Pi Formulas -- from Wolfram MathWorld.pdf
├── Estimation of the number PI – A Monte Carlo simulation _ R-bloggers.pdf
├── scriptlets.py
├── scriptlets.R
├── README.md
├── scriptlets-stage3.R
├── scriptlets-stage2.R
├── example_Rcode.R
├── example_python.py
├── util_functions.R
└── example_python_2.py
├── img
├── init.png
├── merge.png
├── push.png
├── repo1.png
├── setup.png
├── conflict.png
├── old.add.png
├── old.edit.png
├── old.new.png
├── publish.png
├── setup2.png
├── versions.png
├── 2.new-init.png
├── 2.new-push.png
├── 3.new-pull.png
├── first_repo.png
├── first_wip.png
├── old.setup.png
├── old.setup2.png
├── 2.new-setup.png
├── 2.new-setup2.png
├── conflict_text.png
├── finder_view.png
├── local_change.png
├── old.online1.png
├── online_commit.png
├── play-changes.png
├── tracking_mars.png
├── 2.new-first_wip.png
├── 4.01.WIP_amend.png
├── editongithubweb.png
├── merged_example.png
├── old.gotogithub.png
├── repo_on_github.png
├── show_in_finder.png
├── 2.new-finder_view.png
├── 2.new-first_repo.png
├── 2.new-local_change.png
├── 3.delete_one_file.png
├── 4.10.stash_button.png
├── 4.11.after_stash.png
├── conflict_resolved.png
├── file_list_resize.png
├── git-staging-area.png
├── old.local_change.png
├── old.local_conflict.png
├── old.online_commit.png
├── old.online_edits.png
├── old.sync_conflict.png
├── old.synced_change.png
├── old
│ ├── local_conflict.png
│ ├── synced_change1.png
│ ├── synced_change2.png
│ ├── synced_change3.png
│ ├── online_conflict.png
│ ├── get_to_file_history.png
│ ├── local_pull_warning.png
│ ├── mars_file_history.png
│ ├── local_conflict_commit.png
│ ├── history_combined_file_view.png
│ └── file_history_previous_comments.png
├── 2.new-repo_on_github.png
├── 2.new-show_in_finder.png
├── 3.new-conflict_text.png
├── 3.new-online_commit.png
├── 4.02.amend_checkbox.png
├── 4.17.files_after_pop.png
├── commit_conflict_pull.png
├── commit_conflict_push.png
├── initial_commit_stage.png
├── old.commit_conflict.png
├── old.online_conflict.png
├── 2.new-file_list_resize.png
├── 3.commit_uploaded_file.png
├── 3.local_remote_in_sync.png
├── 3.new-conflict_resolved.png
├── 3.upload_files_button.png
├── 3.view_remote_file_diff.png
├── 4.05.undo_button_hover.png
├── 4.14.reset_project_repo.png
├── finder_view_added_files.png
├── merge_confict_warning.png
├── view_origin_on_github.png
├── 2.new-viewing_readme_diff.png
├── 3.commit_delete_one_file.png
├── 3.new-edit_on_github_web.png
├── 3.new-get_to_file_history.png
├── 3.new-local_pull_warning.png
├── 4.08.repo_cleanup_status.png
├── 4.09.reset_master_options.png
├── commit_and_merge_conflict.png
├── commit_mars_first_change.png
├── local_change_after_commit.png
├── merged_conflict_timeline.png
├── 2.new-initial_commit_stage.png
├── 2.new-view_origin_on_github.png
├── 3.new-local_conflict_commit.png
├── 3.new-merge_confict_warning.png
├── 3.new-showing_file_history.png
├── 3.view_remote_commit_changes.png
├── 4.03.click_on_commit_message.png
├── 4.04.update_message_button.png
├── 4.07.commit_a_revert_commit.png
├── 4.13.commit_pointer_changed.png
├── commit_conflict_pull_message.png
├── 2.new-finder_view_added_files.png
├── 2.new-pre_commit_readme_change.png
├── 3.code_folder_after_deletions.png
├── 3.new-merged_conflict_timeline.png
├── 4.06.revert_commit_popup_menu.png
├── 4.12.highlight_previous_commit.png
├── 4.15.ff_reset to latest_commit.png
├── 4.18.files_organized_in_folder.png
├── 4.19.commit_reorganized_files.png
├── after_commit_mars_first_change.png
├── 2.new-local_change_after_commit.png
├── 2.new-post_serial_commit_changes.png
├── 3.new-commit_and_merge_conflict.png
├── 3.new-history_combined_file_view.png
├── commit_conflict_synched_timelines.png
├── merged_conflict_timeline_details.png
├── 3.new-edit_locally_to_make_conflict.png
├── 3.new-edit_online_to_start_conflict.png
├── 4.07b.project_files_cleanup_status.png
├── 4.16.using_pop_to_retrieve_changes.png
├── 2.new-post_coordinated_commit_change.png
├── 3.new-file_history_previous_comments.png
├── 3.new-local_remote_differ_on_commits.png
└── 3.new-commit_conflict_synched_timelines.png
├── _config.yml
├── assets
├── images
│ └── dna-sequence-1600x800.jpg
└── css
│ └── style.scss
├── README.md
├── 01_Intro_to_versioning.md
├── 04_Managing_conflicts.md
├── 05_Working_with_commits.md
├── 03_Github_remote.md
└── 02_GitKraken.md
/docs/README.txt:
--------------------------------------------------------------------------------
1 | ## testing html rendering of lesson pages
2 |
3 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/.DS_Store
--------------------------------------------------------------------------------
/data/gss.dta:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/gss.dta
--------------------------------------------------------------------------------
/img/init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/init.png
--------------------------------------------------------------------------------
/img/merge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/merge.png
--------------------------------------------------------------------------------
/img/push.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/push.png
--------------------------------------------------------------------------------
/img/repo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/repo1.png
--------------------------------------------------------------------------------
/img/setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/setup.png
--------------------------------------------------------------------------------
/img/conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/conflict.png
--------------------------------------------------------------------------------
/img/old.add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.add.png
--------------------------------------------------------------------------------
/img/old.edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.edit.png
--------------------------------------------------------------------------------
/img/old.new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.new.png
--------------------------------------------------------------------------------
/img/publish.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/publish.png
--------------------------------------------------------------------------------
/img/setup2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/setup2.png
--------------------------------------------------------------------------------
/img/versions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/versions.png
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
2 | title: Introduction to Version Control (GitKraken/Github)
3 |
--------------------------------------------------------------------------------
/img/2.new-init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-init.png
--------------------------------------------------------------------------------
/img/2.new-push.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-push.png
--------------------------------------------------------------------------------
/img/3.new-pull.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-pull.png
--------------------------------------------------------------------------------
/img/first_repo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/first_repo.png
--------------------------------------------------------------------------------
/img/first_wip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/first_wip.png
--------------------------------------------------------------------------------
/img/old.setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.setup.png
--------------------------------------------------------------------------------
/img/old.setup2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.setup2.png
--------------------------------------------------------------------------------
/img/2.new-setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-setup.png
--------------------------------------------------------------------------------
/img/2.new-setup2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-setup2.png
--------------------------------------------------------------------------------
/img/conflict_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/conflict_text.png
--------------------------------------------------------------------------------
/img/finder_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/finder_view.png
--------------------------------------------------------------------------------
/img/local_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/local_change.png
--------------------------------------------------------------------------------
/img/old.online1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.online1.png
--------------------------------------------------------------------------------
/img/online_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/online_commit.png
--------------------------------------------------------------------------------
/img/play-changes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/play-changes.png
--------------------------------------------------------------------------------
/img/tracking_mars.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/tracking_mars.png
--------------------------------------------------------------------------------
/data/example_files.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/example_files.zip
--------------------------------------------------------------------------------
/img/2.new-first_wip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-first_wip.png
--------------------------------------------------------------------------------
/img/4.01.WIP_amend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.01.WIP_amend.png
--------------------------------------------------------------------------------
/img/editongithubweb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/editongithubweb.png
--------------------------------------------------------------------------------
/img/merged_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/merged_example.png
--------------------------------------------------------------------------------
/img/old.gotogithub.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.gotogithub.png
--------------------------------------------------------------------------------
/img/repo_on_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/repo_on_github.png
--------------------------------------------------------------------------------
/img/show_in_finder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/show_in_finder.png
--------------------------------------------------------------------------------
/data/Anscombes_quartet.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/Anscombes_quartet.pdf
--------------------------------------------------------------------------------
/data/Anscombes_quartet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/Anscombes_quartet.png
--------------------------------------------------------------------------------
/data/Sailfish_manual.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/Sailfish_manual.docx
--------------------------------------------------------------------------------
/img/2.new-finder_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-finder_view.png
--------------------------------------------------------------------------------
/img/2.new-first_repo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-first_repo.png
--------------------------------------------------------------------------------
/img/2.new-local_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-local_change.png
--------------------------------------------------------------------------------
/img/3.delete_one_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.delete_one_file.png
--------------------------------------------------------------------------------
/img/4.10.stash_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.10.stash_button.png
--------------------------------------------------------------------------------
/img/4.11.after_stash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.11.after_stash.png
--------------------------------------------------------------------------------
/img/conflict_resolved.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/conflict_resolved.png
--------------------------------------------------------------------------------
/img/file_list_resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/file_list_resize.png
--------------------------------------------------------------------------------
/img/git-staging-area.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/git-staging-area.png
--------------------------------------------------------------------------------
/img/old.local_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.local_change.png
--------------------------------------------------------------------------------
/img/old.local_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.local_conflict.png
--------------------------------------------------------------------------------
/img/old.online_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.online_commit.png
--------------------------------------------------------------------------------
/img/old.online_edits.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.online_edits.png
--------------------------------------------------------------------------------
/img/old.sync_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.sync_conflict.png
--------------------------------------------------------------------------------
/img/old.synced_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.synced_change.png
--------------------------------------------------------------------------------
/img/old/local_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/local_conflict.png
--------------------------------------------------------------------------------
/img/old/synced_change1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/synced_change1.png
--------------------------------------------------------------------------------
/img/old/synced_change2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/synced_change2.png
--------------------------------------------------------------------------------
/img/old/synced_change3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/synced_change3.png
--------------------------------------------------------------------------------
/img/2.new-repo_on_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-repo_on_github.png
--------------------------------------------------------------------------------
/img/2.new-show_in_finder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-show_in_finder.png
--------------------------------------------------------------------------------
/img/3.new-conflict_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-conflict_text.png
--------------------------------------------------------------------------------
/img/3.new-online_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-online_commit.png
--------------------------------------------------------------------------------
/img/4.02.amend_checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.02.amend_checkbox.png
--------------------------------------------------------------------------------
/img/4.17.files_after_pop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.17.files_after_pop.png
--------------------------------------------------------------------------------
/img/commit_conflict_pull.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/commit_conflict_pull.png
--------------------------------------------------------------------------------
/img/commit_conflict_push.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/commit_conflict_push.png
--------------------------------------------------------------------------------
/img/initial_commit_stage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/initial_commit_stage.png
--------------------------------------------------------------------------------
/img/old.commit_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.commit_conflict.png
--------------------------------------------------------------------------------
/img/old.online_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old.online_conflict.png
--------------------------------------------------------------------------------
/img/old/online_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/online_conflict.png
--------------------------------------------------------------------------------
/img/2.new-file_list_resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-file_list_resize.png
--------------------------------------------------------------------------------
/img/3.commit_uploaded_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.commit_uploaded_file.png
--------------------------------------------------------------------------------
/img/3.local_remote_in_sync.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.local_remote_in_sync.png
--------------------------------------------------------------------------------
/img/3.new-conflict_resolved.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-conflict_resolved.png
--------------------------------------------------------------------------------
/img/3.upload_files_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.upload_files_button.png
--------------------------------------------------------------------------------
/img/3.view_remote_file_diff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.view_remote_file_diff.png
--------------------------------------------------------------------------------
/img/4.05.undo_button_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.05.undo_button_hover.png
--------------------------------------------------------------------------------
/img/4.14.reset_project_repo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.14.reset_project_repo.png
--------------------------------------------------------------------------------
/img/finder_view_added_files.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/finder_view_added_files.png
--------------------------------------------------------------------------------
/img/merge_confict_warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/merge_confict_warning.png
--------------------------------------------------------------------------------
/img/old/get_to_file_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/get_to_file_history.png
--------------------------------------------------------------------------------
/img/old/local_pull_warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/local_pull_warning.png
--------------------------------------------------------------------------------
/img/old/mars_file_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/mars_file_history.png
--------------------------------------------------------------------------------
/img/view_origin_on_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/view_origin_on_github.png
--------------------------------------------------------------------------------
/img/2.new-viewing_readme_diff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-viewing_readme_diff.png
--------------------------------------------------------------------------------
/img/3.commit_delete_one_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.commit_delete_one_file.png
--------------------------------------------------------------------------------
/img/3.new-edit_on_github_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-edit_on_github_web.png
--------------------------------------------------------------------------------
/img/3.new-get_to_file_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-get_to_file_history.png
--------------------------------------------------------------------------------
/img/3.new-local_pull_warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-local_pull_warning.png
--------------------------------------------------------------------------------
/img/4.08.repo_cleanup_status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.08.repo_cleanup_status.png
--------------------------------------------------------------------------------
/img/4.09.reset_master_options.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.09.reset_master_options.png
--------------------------------------------------------------------------------
/img/commit_and_merge_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/commit_and_merge_conflict.png
--------------------------------------------------------------------------------
/img/commit_mars_first_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/commit_mars_first_change.png
--------------------------------------------------------------------------------
/img/local_change_after_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/local_change_after_commit.png
--------------------------------------------------------------------------------
/img/merged_conflict_timeline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/merged_conflict_timeline.png
--------------------------------------------------------------------------------
/img/old/local_conflict_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/local_conflict_commit.png
--------------------------------------------------------------------------------
/img/2.new-initial_commit_stage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-initial_commit_stage.png
--------------------------------------------------------------------------------
/img/2.new-view_origin_on_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-view_origin_on_github.png
--------------------------------------------------------------------------------
/img/3.new-local_conflict_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-local_conflict_commit.png
--------------------------------------------------------------------------------
/img/3.new-merge_confict_warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-merge_confict_warning.png
--------------------------------------------------------------------------------
/img/3.new-showing_file_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-showing_file_history.png
--------------------------------------------------------------------------------
/img/3.view_remote_commit_changes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.view_remote_commit_changes.png
--------------------------------------------------------------------------------
/img/4.03.click_on_commit_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.03.click_on_commit_message.png
--------------------------------------------------------------------------------
/img/4.04.update_message_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.04.update_message_button.png
--------------------------------------------------------------------------------
/img/4.07.commit_a_revert_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.07.commit_a_revert_commit.png
--------------------------------------------------------------------------------
/img/4.13.commit_pointer_changed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.13.commit_pointer_changed.png
--------------------------------------------------------------------------------
/img/commit_conflict_pull_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/commit_conflict_pull_message.png
--------------------------------------------------------------------------------
/data/Anscombes quartet - Wikipedia.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/Anscombes quartet - Wikipedia.pdf
--------------------------------------------------------------------------------
/img/2.new-finder_view_added_files.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-finder_view_added_files.png
--------------------------------------------------------------------------------
/img/2.new-pre_commit_readme_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-pre_commit_readme_change.png
--------------------------------------------------------------------------------
/img/3.code_folder_after_deletions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.code_folder_after_deletions.png
--------------------------------------------------------------------------------
/img/3.new-merged_conflict_timeline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-merged_conflict_timeline.png
--------------------------------------------------------------------------------
/img/4.06.revert_commit_popup_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.06.revert_commit_popup_menu.png
--------------------------------------------------------------------------------
/img/4.12.highlight_previous_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.12.highlight_previous_commit.png
--------------------------------------------------------------------------------
/img/4.15.ff_reset to latest_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.15.ff_reset to latest_commit.png
--------------------------------------------------------------------------------
/img/4.18.files_organized_in_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.18.files_organized_in_folder.png
--------------------------------------------------------------------------------
/img/4.19.commit_reorganized_files.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.19.commit_reorganized_files.png
--------------------------------------------------------------------------------
/img/after_commit_mars_first_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/after_commit_mars_first_change.png
--------------------------------------------------------------------------------
/img/old/history_combined_file_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/history_combined_file_view.png
--------------------------------------------------------------------------------
/assets/images/dna-sequence-1600x800.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/assets/images/dna-sequence-1600x800.jpg
--------------------------------------------------------------------------------
/data/5 Ways to Calculate Pi - wikiHow.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/5 Ways to Calculate Pi - wikiHow.pdf
--------------------------------------------------------------------------------
/img/2.new-local_change_after_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-local_change_after_commit.png
--------------------------------------------------------------------------------
/img/2.new-post_serial_commit_changes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-post_serial_commit_changes.png
--------------------------------------------------------------------------------
/img/3.new-commit_and_merge_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-commit_and_merge_conflict.png
--------------------------------------------------------------------------------
/img/3.new-history_combined_file_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-history_combined_file_view.png
--------------------------------------------------------------------------------
/img/commit_conflict_synched_timelines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/commit_conflict_synched_timelines.png
--------------------------------------------------------------------------------
/img/merged_conflict_timeline_details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/merged_conflict_timeline_details.png
--------------------------------------------------------------------------------
/img/3.new-edit_locally_to_make_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-edit_locally_to_make_conflict.png
--------------------------------------------------------------------------------
/img/3.new-edit_online_to_start_conflict.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-edit_online_to_start_conflict.png
--------------------------------------------------------------------------------
/img/4.07b.project_files_cleanup_status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.07b.project_files_cleanup_status.png
--------------------------------------------------------------------------------
/img/4.16.using_pop_to_retrieve_changes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/4.16.using_pop_to_retrieve_changes.png
--------------------------------------------------------------------------------
/img/old/file_history_previous_comments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/old/file_history_previous_comments.png
--------------------------------------------------------------------------------
/data/Pi Formulas -- from Wolfram MathWorld.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/Pi Formulas -- from Wolfram MathWorld.pdf
--------------------------------------------------------------------------------
/img/2.new-post_coordinated_commit_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/2.new-post_coordinated_commit_change.png
--------------------------------------------------------------------------------
/img/3.new-file_history_previous_comments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-file_history_previous_comments.png
--------------------------------------------------------------------------------
/img/3.new-local_remote_differ_on_commits.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-local_remote_differ_on_commits.png
--------------------------------------------------------------------------------
/img/3.new-commit_conflict_synched_timelines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/img/3.new-commit_conflict_synched_timelines.png
--------------------------------------------------------------------------------
/data/Estimation of the number PI – A Monte Carlo simulation _ R-bloggers.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hbctraining/versioning_data_scripts/HEAD/data/Estimation of the number PI – A Monte Carlo simulation _ R-bloggers.pdf
--------------------------------------------------------------------------------
/data/scriptlets.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | # Put comments here
4 | # including pseudo-code of program flow
5 |
6 | # Put globals and imports here
7 |
8 | # Put functions here
9 |
10 | # now your main code
11 |
12 | # END
13 |
14 |
--------------------------------------------------------------------------------
/data/scriptlets.R:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 |
3 | # Put comments here
4 | # including pseudo-code of program flow
5 |
6 | # Put globals, installs, and sources here
7 |
8 | # Put functions here
9 |
10 | # now your main code
11 |
12 | # END
13 |
14 |
--------------------------------------------------------------------------------
/data/README.md:
--------------------------------------------------------------------------------
1 | README.md
2 |
3 | ###NAME
4 |
5 | ##Overview
6 | Our code will demonstrate the different ways it is possible to calculate the value of pi, done in either
7 |
8 | ##Installation
9 |
10 | ##Usage
11 |
12 |
13 | ##Getting help
14 |
15 |
16 | ## Contributors
17 |
18 | ## Reference
19 |
20 | ## Licensing
21 |
22 |
23 |
--------------------------------------------------------------------------------
/assets/css/style.scss:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 |
4 | @import "{{ site.theme }}";
5 |
6 | .page-header { color: #fff; text-align: center; background-image: url("../images/dna-sequence-1600x800.jpg"); }
7 |
8 | .main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 { margin-top: 2rem; margin-bottom: 1rem; font-weight: normal; color: #000000; }
9 |
--------------------------------------------------------------------------------
/data/scriptlets-stage3.R:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 |
3 | # This script will include a collection of small scripts steps
4 | # often seen as example code. We're using this solely for demo purposes
5 |
6 | # Put globals, installs, and sources here
7 | source("./util_functions.R")
8 |
9 | # Put functions here
10 | # 1. Prints hello world
11 | hello_world <- function() {
12 | myString <- "Hello, World!"
13 | print (myString)
14 | }
15 |
16 |
17 | # main code
18 |
19 | hello_world()
20 |
21 | square_it(10)
22 |
23 | montecarloPi(3000)
24 |
25 | # END
26 |
27 |
--------------------------------------------------------------------------------
/data/scriptlets-stage2.R:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 |
3 | # This script will include a collection of small scripts steps
4 | # often seen as example code. We're using this solely for demo purposes
5 |
6 |
7 | # 1. Prints hello world
8 |
9 | myString <- "Hello, World!"
10 |
11 | print (myString)
12 |
13 |
14 | # 2. Square function
15 | # adapted from https://hbctraining.github.io/Intro-to-R/lessons/03_introR-functions-and-arguments.html#user-defined-functions
16 | # and https://www.r-bloggers.com/how-to-write-and-debug-an-r-function/
17 |
18 | square_it <- function(x){
19 | sq <- x*x
20 | return(sq)
21 | }
22 |
23 | square_it(5)
24 |
25 |
26 | # 3. Monte Carlo Pi
27 |
28 | for (trials in 1:3000) {
29 | count = 0
30 | for(i in 1:trials) {
31 | if((runif(1,0,1)^2 + runif(1,0,1)^2) < 1) {
32 | count = count + 1
33 | }
34 | }
35 | print(paste(trials, ": ", (count*4) / trials))
36 | }
37 |
38 |
39 | # END
40 |
41 |
--------------------------------------------------------------------------------
/data/example_Rcode.R:
--------------------------------------------------------------------------------
1 | # An excercise in R
2 |
3 |
4 | # Print Hello World
5 | myString <- "Hello, World!"
6 |
7 | print (myString)
8 |
9 |
10 | # Monte Carlo Pi
11 | montecarloPi <- function(trials) {
12 | count = 0
13 | for(i in 1:trials) {
14 | if((runif(1,0,1)^2 + runif(1,0,1)^2) < 1) {
15 | count = count + 1
16 | }
17 | }
18 | return((count*4) / trials)
19 | }
20 |
21 |
22 | # Estimate Pi
23 | est.pi <- function(n){
24 |
25 | # drawing in [0,1] x [0,1] covers one quarter of square and circle
26 | # draw random numbers for the coordinates of the "dart-hits"
27 | a <- runif(n,0,1)
28 | b <- runif(n,0,1)
29 | # use the pythagorean theorem
30 | c <- sqrt((a^2) + (b^2) )
31 |
32 | inside <- sum(c<1)
33 | #outside <- n-inside
34 |
35 | pi.est <- inside/n*4
36 |
37 | return(pi.est)
38 | }
39 |
40 |
41 | # Square function
42 | square_it <- function(x){
43 | sq <- x*x
44 | return(sq)
45 | }
46 |
47 |
48 | #Anscombe's quartet
49 | library(Tmisc)
50 |
51 | # Load the data and look at it
52 | data(quartet)
53 | str(quartet)
54 |
55 | # Compute simple statistics for each
56 | library(dplyr)
57 | quartet %>%
58 | group_by(set) %>%
59 | summarize(mean(x), sd(x), mean(y), sd(y), cor(x,y))
60 |
61 | # Visualize the data
62 | library(ggplot2)
63 | ggplot(quartet, aes(x, y)) +
64 | geom_point() +
65 | geom_smooth(method = lm, se = FALSE) +
66 | facet_wrap(~set)
67 |
68 |
--------------------------------------------------------------------------------
/data/example_python.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | # Import packages at beginning of script.
4 | # matplotlib and seaborn needed for Anscombe's quartet example
5 | import matplotlib.pyplot as plt
6 | import seaborn as sns
7 |
8 | # 1. prints "Hello world!" text to the screen when the program is run.
9 | print("Hello world!")
10 |
11 | # 2. Calculate pi
12 |
13 |
14 |
15 | # 3. Square function
16 | # adapted from https://hbctraining.github.io/Intro-to-R/lessons/03_introR-functions-and-arguments.html#user-defined-functions
17 | # and https://www.r-bloggers.com/how-to-write-and-debug-an-r-function/
18 | x = 5
19 | square = x*x
20 | print(square)
21 |
22 | # 4. Anscombe's quartet
23 | # https://en.wikipedia.org/wiki/Anscombe%27s_quartet
24 | # code from https://seaborn.pydata.org/examples/anscombes_quartet.html
25 | # set seaborn "ticks" theme
26 | sns.set(style="ticks")
27 |
28 | # Load the example dataset for Anscombe's quartet
29 | anscombes_quartet = sns.load_dataset("anscombe")
30 |
31 | # Show the results of a linear regression within each dataset
32 | # will create 4 plots for each of the datasets
33 | # reference https://seaborn.pydata.org/generated/seaborn.lmplot.html for descriptions of what these parameters do
34 | sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=anscombes_quartet,
35 | col_wrap=2, ci=None, palette="colorblind", height=4,
36 | scatter_kws={"s": 50, "alpha": 1})
37 | # save the plots to a file
38 | plt.savefig("anscombe.png")
39 | # if you'd prefer to view the figure instead of saving it to a file, then uncomment and run the next line:
40 | #plt.show()
41 |
--------------------------------------------------------------------------------
/data/util_functions.R:
--------------------------------------------------------------------------------
1 | # Small script snipplets that can be brief
2 | # examples for programming or demonstrations
3 |
4 |
5 | # Print Hello World
6 | hello_world <- function() {
7 | myString <- "Hello, World!"
8 | print (myString)
9 | }
10 |
11 |
12 | # Monte Carlo Pi
13 | montecarloPi <- function(trials) {
14 | count = 0
15 | for(i in 1:trials) {
16 | if((runif(1,0,1)^2 + runif(1,0,1)^2) < 1) {
17 | count = count + 1
18 | }
19 | }
20 | return((count*4) / trials)
21 | }
22 |
23 |
24 | # Estimate Pi
25 | est.pi <- function(n){
26 |
27 | # drawing in [0,1] x [0,1] covers one quarter of square and circle
28 | # draw random numbers for the coordinates of the "dart-hits"
29 | a <- runif(n,0,1)
30 | b <- runif(n,0,1)
31 | # use the pythagorean theorem
32 | c <- sqrt((a^2) + (b^2) )
33 |
34 | inside <- sum(c<1)
35 | #outside <- n-inside
36 |
37 | pi.est <- inside/n*4
38 |
39 | return(pi.est)
40 | }
41 |
42 |
43 | # Square function
44 | square_it <- function(x){
45 | sq <- x*x
46 | return(sq)
47 | }
48 |
49 |
50 | # Anscombe's quartet
51 | anscombes_quartet <- {
52 | library(Tmisc)
53 |
54 | # Load the data and look at it
55 | data(quartet)
56 | str(quartet)
57 |
58 | # Compute simple statistics for each
59 | library(dplyr)
60 | quartet %>%
61 | group_by(set) %>%
62 | summarize(mean(x), sd(x), mean(y), sd(y), cor(x,y))
63 |
64 | # Visualize the data
65 | library(ggplot2)
66 | ggplot(quartet, aes(x, y)) +
67 | geom_point() +
68 | geom_smooth(method = lm, se = FALSE) +
69 | facet_wrap(~set)
70 | }
71 |
--------------------------------------------------------------------------------
/data/example_python_2.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | # Import packages at beginning of script.
4 | # matplotlib and seaborn needed for Anscombe's quartet example
5 | import matplotlib.pyplot as plt
6 | import seaborn as sns
7 |
8 | # Define the four functions.
9 |
10 | # 1. prints "Hello world!" text to the screen when the function is called.
11 | def greeting():
12 | print("Hello world!")
13 |
14 | # 2. Calculate pi
15 |
16 |
17 |
18 | # 3. Square function
19 | # adapted from https://hbctraining.github.io/Intro-to-R/lessons/03_introR-functions-and-arguments.html#user-defined-functions
20 | # and https://www.r-bloggers.com/how-to-write-and-debug-an-r-function/
21 |
22 | # function returns the squared value of a integer, assuming an integer is passed to it
23 | def square_it(x):
24 | square = x*x
25 | return square
26 |
27 | # 4. Anscombe's quartet
28 | # https://en.wikipedia.org/wiki/Anscombe%27s_quartet
29 | # code from https://seaborn.pydata.org/examples/anscombes_quartet.html
30 | def anscombe():
31 | # set seaborn "ticks" theme
32 | sns.set(style="ticks")
33 |
34 | # Load the data for Anscombe's quartet from the seaborn package
35 | anscombes_quartet = sns.load_dataset("anscombe")
36 |
37 | # Show the results of a linear regression within each dataset
38 | # will create 4 plots, one for each of the datasets
39 | # reference https://seaborn.pydata.org/generated/seaborn.lmplot.html for descriptions of what these parameters do
40 | sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=anscombes_quartet,
41 | col_wrap=2, ci=None, palette="colorblind", height=4,
42 | scatter_kws={"s": 50, "alpha": 1})
43 | # save the plots to a file
44 | plt.savefig("anscombe.png")
45 | # if you'd prefer to view the figure instead of saving it to a file, then uncomment and run the next line:
46 | #plt.show()
47 |
48 | # Code that doesn't belong in functions goes here
49 | # Call each of the functions
50 | def main():
51 | greeting()
52 | # will need to call calculate pi function here once it is written
53 | print( square_it(5) )
54 | anscombe()
55 |
56 | # see https://docs.python.org/3.7/library/__main__.html
57 | if __name__ == '__main__':
58 | main()
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Versioning your Data and Scripts
3 |
4 | December, 2019
5 |
6 | Authors: Bob Freeman ([devbioinfoguy](https://github.com/devbioinfoguy)), Radhika Khetani ([rkhetani](https://github.com/rkhetani)), Meeta Mistry ([mistrm82](https://github.com/mistrm82)), Kathleen Keating ([kthlnktng](https://github.com/kthlnktng))
7 |
8 | ## Overview:
9 | Tired of wading through files/folders titled 'paper_v1', 'paper_v2', 'paper_v3_beforeAdvisor'... ? This hands-on workshop will introduce the concepts of using a version control system to manage changes and the history of your data files (text, data, scripts, etc.) with [Git](https://git-scm.com/) using the [GitKraken](https://www.gitkraken.com/) interface, as well as on [GitHub](github.com).
10 |
11 | Attendees will participate in multiple exercises to learn how version control works, including:
12 | * setting up Git repositories
13 | * recording changes
14 | * working both locally and remotely on GitHub
15 | * managing conflicts
16 | * best practices for working with version control
17 |
18 | ## Pre-lesson Preparation:
19 |
20 | 1. Please [Download and install GitKraken](https://gitkraken.com/download).
21 | 2. Create an account for yourself on [GitHub](http://github.com). Please be sure to select the free/academic account, as this option has more long-term flexibility.
22 | 3. Download the [workshop sample files zipped folder](https://github.com/hbctraining/versioning_data_scripts/raw/master/data/example_files.zip) and unzip it.
23 |
24 | ## Lessons:
25 |
26 | 1. [Introduction to Version Control](01_Intro_to_versioning.md)
27 | 2. [Getting Started with Git using GitKraken](02_GitKraken.md)
28 | 3. [Remote repositories](03_Github_remote.md)
29 | 4. [Managing Conflicts](https://hbctraining.github.io/versioning_data_scripts/04_Managing_conflicts.html)
30 |
31 | ***
32 |
33 | * Materials used in these lessons are derived from Daniel van Strien's ["An Introduction to Version Control Using GitHub Desktop,"](http://programminghistorian.org/lessons/getting-started-with-github-desktop), Programming Historian, (17 June 2016). [The Programming Historian ISSN 2397-2068](http://programminghistorian.org/), is released under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
34 |
35 | * Materials are also derived from [Software Carpentry instructional material](https://swcarpentry.github.io/git-novice/). These materials are also licensed under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
36 |
37 | NOTE: These materials and the files within are governed by the Creative Commons Attribution license (CC BY 4.0).
38 |
--------------------------------------------------------------------------------
/01_Intro_to_versioning.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: "Introduction to Versioning"
4 | author: "Daniel van Strien, Radhika Khetani, Bob Freeman, Meeta Mistry, Kathleen Keating, Amir Karger"
5 | ---
6 |
7 | # Versioning your Data and Scripts
8 |
9 | ***
10 | Previous: [README](README.md)
11 |
12 | ***
13 |
14 | ## Setting up for today's class
15 |
16 | For this quick hands-on session we will be using a Graphical User Interface (GUI) to work with Git. Let's start by:
17 | 1. [Downloading and installing GitKraken](https://gitkraken.com/download).
18 | 2. Creating an account for yourself on [GitHub](http://github.com). Please **select the free/academic account**, as this option has more long-term flexibility.
19 | 3. Downloading the [workshop sample files zipped folder](https://github.com/hbctraining/versioning_data_scripts/raw/master/data/example_files.zip) and unzip it.
20 |
21 | ## What is Version Control?
22 |
23 | Version control can be used to keep track of versions of a piece of work that either a single person is working on, or a shared document. It is designed to avoid a situation like noted below.
24 |
25 | ```
26 | mydocument.txt
27 | mydocument_v2.txt
28 | mydocument_v3_rev-BHP.txt
29 | mydocument_v8_Final?.txt
30 | ```
31 |
32 | Some tools let us deal with this a bit better without creating a new file for every "save", such as Microsoft Word's "Track Changes" or DropBox's and Google Docs' "version history" feature.
33 |
34 | Version control systems start with a base version of the document and then save just the changes you made at each step of the way by taking a so-called "snapshot". A snapshot records information about when a doc was saved, and all the changes between the current document and the previous version. The user (you) decides when these snapshots are collected, and this allows one to ‘rewind’ your file to an older version.
35 |
36 |
37 |
38 | For example, two users can make independent sets of changes based on the same document and have 2 separate snapshots documenting the changes.
39 |
40 |
41 |
42 | If there aren't conflicts (i.e updates to the same line), the two sets of changes can be "merged" back into the same base document.
43 |
44 |
45 |
46 | ### Version Control Systems and Hosts
47 |
48 | There are a lot of [different version control systems available](https://en.wikipedia.org/wiki/List_of_version_control_software). These systems enable you to track changes locally or remotely (easy for collaborations), and there are hosts available for remote management of your "[repositories](https://en.wikipedia.org/wiki/Repository_(version_control))".
49 |
50 | In this class we will be focusing on [Git](https://git-scm.com/). Git is usually used for version control on a local computer and you do not need internet access to use it (internet access will be needed to download Git). The local version control setup with Git (or other version control systems) can be connected to an online setup that hosts repositories for sharing and collaboration.
51 |
52 | GitHub is currently the most popular host of open source projects by [number of projects and number of users](https://en.wikipedia.org/wiki/Comparison_of_source_code_hosting_facilities#Popularity). But other hosts exist, including [SourceForge](https://sourceforge.net/), [BitBucket](https://bitbucket.org/), and [Gitlab](https://about.gitlab.com/), to name a few.
53 |
54 | ## Why use Version Control?
55 |
56 | The two main reasons to use version control are to:
57 |
58 | * Manage text/data/code effectively
59 | * Collaborate efficiently
60 |
61 | Though version control was originally designed for dealing with code for large collaborative projects, there are many benefits to using it in other projects with ***text files*** too (`.txt`, `.csv`, `.tsv`). Some examples of projects making use of version control systems like Git: writing manuscripts, books or dissertations, and for collaboratively developing as well as distributing teaching materials ([e.g. the Github repository for this class](https://github.com/hbctraining/versioning_data_scripts/)).
62 |
63 | > Note: Different Version Control systems handle different *non-text files* differently.
64 | > In most cases Word documents, graphics files, data objects from R or STATA, etc., can be included but most tools have limited capabilities for saving version information for these.
65 |
66 | **Why Not use Dropbox or Google Drive?**
67 |
68 | Dropbox, Google Drive and other services offer some form of version control in their systems. There are times when this may be sufficient for your needs. However there are a number of advantages to using a version control system like Git, e.g. facilitating sharing/reproducibility and collaborations. Benefits of collaborating with Version Control include:
69 |
70 | * Supports both text and programming languages, and gives the user much more control over how code is represented and disseminated
71 | * Allows comments on every modification making it easier to revert to older version
72 | * Allows you and others to navigate the history of a document readily
73 | * Ensures that changes across multiple documents are coordinated and saved together (easy conflict resolution)
74 |
75 | ***
76 | Next: [Getting Started with Git using GitKraken](02_GitKraken.md)
77 |
78 | ***
79 |
80 | * Materials used in these lessons are derived from Daniel van Strien's ["An Introduction to Version Control Using GitHub Desktop,"](http://programminghistorian.org/lessons/getting-started-with-github-desktop), Programming Historian, (17 June 2016). [The Programming Historian ISSN 2397-2068](http://programminghistorian.org/), is released under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
81 |
82 | * Materials are also derived from [Software Carpentry instructional material](https://swcarpentry.github.io/git-novice/). These materials are also licensed under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
83 |
--------------------------------------------------------------------------------
/04_Managing_conflicts.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: "Managing Conflicts"
4 | author: "Bob Freeman, Meeta Mistry, Radhika Khetani, Kathleen Keating"
5 | ---
6 |
7 | ***
8 |
9 | Previous: [Git(hub) Remote](03_Github_remote.md)
10 |
11 | ***
12 |
13 | ## Managing Conflicts
14 |
15 | A **conflict** emerges when you try to merge (sync) two versions of a document with changes which conflict with each other. If you are careful about committing and syncing then it is unlikely you will run into this issue; but if you do, it can be resolved fairly easily.
16 |
17 | The most likely way a conflict will emerge is if you, or if you are sharing your repo with a collaborator, make a change on either the local or online repo, and then make a subsequent change on the other without first syncing the changes.
18 |
19 | If you make changes in different parts of a file or within the repo, these changes can be merged (synced) together without any conflict. But if these changes conflict with one another – if you try and change the same line of the document in two different ways – that's when there is an issue, as Git will not know which change is the one you wish to keep.
20 |
21 |
22 |
23 | An example will help illustrate the most likely way conflicts can emerge, and how to deal with them.
24 |
25 | Let's add a change to our remote repository to main documentation `README.md` file. The first title line isn't properly formatted. Let's edit this file and line with a single `#` as an H1 tag:
26 |
27 |
28 |
29 | Don't forget commit this change on the website.
30 |
31 | Without syncing, make a change to the same document using the text editor locally:
32 |
33 |
34 |
35 | Save the changed file. Return to GitKraken, click on the WIP line, stage your change, add a description, and Commit:
36 |
37 |
38 |
39 | Note the divergence as a branch. Synchronize the repos by doing a Push. GitKraken warns us that we are behind the remote, so we must do a Pull:
40 |
41 |
42 |
43 | Once you do the Pull, we get a transient message about a 'Merge Conflict' and a timeline message warning us about "Merge Conflicts", which is not unexpected:
44 |
45 |
46 |
47 | This is not a big problem: What Git is aking you to do is manage these conflicts. GitKraken offers you the option of opening the file with the sync conflicts.
48 |
49 | Instead, open the file with an external text editor (the document will open with whichever text editor/application we have chosen as the default for opening Markdown files).
50 |
51 |
52 |
53 | Looking at the file, we will see Git has denoted the conflicting section (selected here).
54 |
55 |
56 |
57 | This conflicting section is marked with `<<<<<<<` and ends with `>>>>>>>`. These are known as the **conflict markers**. The two conflicting blocks are divided by a `=======` line.
58 |
59 | There are a number of approaches to dealing with a conflict:
60 |
61 | * You could choose to go with either of the changes by deleting the version you no longer want and removing the conflict markers, OR
62 |
63 | * You could change the section entirely and not choose either of the options, OR
64 |
65 | * You could keep both of the versions
66 |
67 | Whichever option you choose, you must **remove** the conflict markers in order to proceed. We're going to keep the local copy, as it is more informative. Once you have *resolved* the conflict, save the file, click on the conflict timeline entry, and indicate to GitKraken that you have resolved the problem in the lower section:
68 |
69 |
70 |
71 | and then proceed to **commit** and merge the changes (resolved conflict). When you go to Commit your changes you see that GitKraken specifies that the commit is to merge a conflict. This is useful historical information if you later wish to review how you managed any conflicts:
72 |
73 |
74 |
75 | GK now shows our commit & its message in the timeline in the upper pane:
76 |
77 |
78 |
79 | Now, synchronize your local changes by the standard workflow of **Pull and Push** and your local and remote repositories will be in sync:
80 |
81 |
82 |
83 |
84 | This may seem like a convoluted approach to dealing with conflicts, but it is very useful as you have total control and the last word in dealing with conflicts. In contrast, if conflicts emerge on a system like Dropbox, the result is two files being created: Although this is better than potentially losing important changes, it also means you still have to look at these two documents and decide how you are going to merge them.
85 |
86 | If you are careful about always syncing changes you will be able to avoid having to deal with conflicts. When collaborating, the likelihood for conflicts increases; so, it is useful to be aware of how to deal with conflicts before you begin to collaborate using GitHub.
87 |
88 | ***
89 |
90 | **Exercise #3**
91 |
92 | 1. Create a conflict within the "data-file.txt" file by making changes locally and remotely.
93 | 2. Resolve the conflict and commit.
94 | 3. [Optional] Add your neighbor as a collaborator to a the "learning_github" repo (in Settings -> Collaborators & teams), make changes to create a conflict within the "data-file.txt" document in one of the repos (pick one), and resolve the conflict.
95 |
96 | ***
97 |
98 | * Materials used in these lessons are derived from Daniel van Strien's ["An Introduction to Version Control Using GitHub Desktop,"](http://programminghistorian.org/lessons/getting-started-with-github-desktop), Programming Historian, (17 June 2016). [The Programming Historian ISSN 2397-2068](http://programminghistorian.org/), is released under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
99 |
100 | * Materials are also derived from [Software Carpentry instructional material](https://swcarpentry.github.io/git-novice/). These materials are also licensed under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
101 |
--------------------------------------------------------------------------------
/05_Working_with_commits.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: "Working with Commits"
4 | author: "Bob Freeman, Radhika Khetani, Amir Karger"
5 | ---
6 |
7 | ***
8 | Previous: [Remote repositories, managing conflicts](03_Github_remote_and_conflicts.md)
9 |
10 | ***
11 | Objectives:
12 | - Learn how to amend a commit
13 | - Learn how to revert a commit
14 | - Learn how to work with a previous commit
15 | - Learn how to temporarily hide work in progress
16 |
17 |
18 | ## Working with Commits
19 |
20 | Sometimes a simple commit isn't that simple: you've forgotten something, you need to undo what you've done, or you need to go back to something you committed some time ago. This section with help you navigate these items.
21 |
22 | ## Amending Commits
23 |
24 | Oops! Pushed 'Commit' button too fast? As long as you have not updated any remotes, you can amend the last commit message, add additional changes, or both.
25 |
26 | To make changes / add files, click on the //WIP node on the graph:
27 |
28 |
29 |
30 | stage the files would wish to include in the updated commit, and selected the Amend checkbox in the Commit Message pane:
31 |
32 |
33 |
34 | You'll note that the previous commit message is copied into the Message and Description fields. And the Commit button is titled Amend Previous Commit instead. Go ahead.
35 |
36 | If you wish to amend the message only, hover over and click on the commit message in the bottom pane for the latest commit:
37 |
38 |
39 |
40 | Change your commit message, and click on the Update Message button at the bottom:
41 |
42 |
43 |
44 |
45 | ## Reverting Commits
46 |
47 | Sometimes you just want to undo the last thing you did. Like that last change (e.g. commit, branch, etc) you didn't mean to make? GitKraken's Undo button in the top toolbar will let you undo most actions (which can also Redo if needed!). Hover over the Undo button to see what action it will take, and click if that seems appropriate:
48 |
49 |
50 |
51 | If the Undo option is not available or not appropriate, one can use the Revert Commit option for the latest commit or even a previous one. This will not only bring back the changes to your working directory, but will include an explicit commit to document that this change to the repo. To perform this, click on the commit node, and right-mouse click to see the popup menu. From there, select the Revert Commit option:
52 |
53 |
54 |
55 | When prompted, you can immediate commit this explicit change, or keep the changes as a WIP (work in progress) for you to do additional work. Clicking Yes enters the new commit to your repo:
56 |
57 |
58 |
59 | **Exercises-Coming soon!**
60 |
61 | ## Resetting (Checking Out Previous) Commits, and Stash/Pop
62 |
63 | At times, there may be the need to go back in history to a previous commit: perhaps you wish to retrieve files that you've deleted or changed, or perhaps you wish to inspect the state of your project and code to inform current work. No matter, like a time machine, Git allows you to move the pointer on your repo to any commit, and it will likewise change the repo files and structure to reflect that.
64 |
65 | To get us there, we're going to do a little cleanup on our project repo. We forgot to include the other files from our project download, so let's include those files in a folder and make the commit:
66 |
67 |
68 |
69 |
70 | In addition, you should create two new files for Jupiter and Saturn, and add those to the project directory, creating a WIP entry. Your commit timeline should look like the following:
71 |
72 |
73 |
74 | But we realized that we had, in a previous commit, that we deleted the entries for other outer planet entries (asteroid belt, Uranus, & Neptune). Now, we want those back. Working with a previous commit will help us here. If we right-click on the previous commit with these files, "Including outer system planets", we have an option to "Reset master to this commit", with three options: soft, mixed, and hard:
75 |
76 |
77 |
78 | Although using the 'soft' option may seems safest -- keeping any changes -- one could run into problems if there are files that overlap or change over time. We don't want conflicts. But the 'hard' option seems extreme. What about the files we've added to our project that haven't yet saved?
79 |
80 | Stash to the rescue! This option let's us hide our current work and changes to a safe, hidden, location, so that when resetting our commit pointer we won't lose our work.
81 |
82 |
83 |
84 | After stashing, we have an indicator that our files are safe; and we can see the previous commit is still present:
85 |
86 |
87 |
88 | So let's go back to our previous commit "Including outer system planets" and click on it to highlight:
89 |
90 |
91 |
92 | Right-mouse click, select "Reset master to this commit", and the option "Hard - discard all changes". Your commit pointer for local repo will now point to this commit:
93 |
94 |
95 |
96 | and the project repo will change accordingly:
97 |
98 |
99 |
100 | Let's grab the three files from our project repo -- asteroid belt, Uranus, & Neptune -- and set them aside. Let's fast-forward the commits to go back to our previous state by highlighting the last commit, right-mouse click it, and select the same reset commit options: "Reset master to this commit" > "Hard - discard all changes":
101 |
102 |
103 |
104 | Now that we're back to where we were, let's get our stashed, hidden repo changes back by using the Pop option:
105 |
106 |
107 |
108 | Once popped, we can see our files where we'd left them:
109 |
110 |
111 |
112 | And finally, let's organize our files into a coherent folder, reflected both in our filesystem:
113 |
114 |
115 |
116 | and make this commit in GitKraken:
117 |
118 |
119 |
120 | **Exercises-Coming soon!**
121 |
122 | ## Next steps and Resources
123 |
124 | GitKraken offers an easy way of getting started with GitHub and version control. Depending on your use case it may be sufficient for your needs. If you are already familiar with using the Command Line then using Git on the Command Line is recommended.
125 |
126 | This lesson introduced you to the most rudimentary (yet very useful) concepts and terminology associated with using Version control (Git). The resources below will allow you get started with getting a deeper/better understanding of version control.
127 |
128 | * The [GitKraken guide](https://support.gitkraken.com/getting-started/guide) is a great way to start exploring it's functionality, and learning more about what Git can do.
129 | * GitHub also provides extensive support in the form of [guides](https://guides.github.com/) and [help](https://help.github.com/).
130 | * GitHub [Glossary](https://help.github.com/articles/github-glossary/) outlines the most commonly used GitHub/Git terminology.
131 |
132 | ***
133 |
134 | * Materials used in these lessons are derived from Daniel van Strien's ["An Introduction to Version Control Using GitHub Desktop,"](http://programminghistorian.org/lessons/getting-started-with-github-desktop), Programming Historian, (17 June 2016). [The Programming Historian ISSN 2397-2068](http://programminghistorian.org/), is released under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
135 |
136 | * Materials are also derived from [Software Carpentry instructional material](https://swcarpentry.github.io/git-novice/). These materials are also licensed under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
137 |
138 | * Materials are also derived from [GitKraken Support for Git Client](https://support.gitkraken.com/start-here/interface/) on GitKraken's website.
139 |
--------------------------------------------------------------------------------
/03_Github_remote.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: "Git(hub) Remote"
4 | author: "Bob Freeman, Meeta Mistry, Radhika Khetani, Kathleen Keating"
5 | ---
6 |
7 | ***
8 | Previous: [Getting Started with Git using GitKraken](02_GitKraken.md)
9 |
10 | ***
11 |
12 | ## Repositories online (remote)
13 |
14 | ### Pushing Your Changes to Your Remote Repository
15 |
16 | In the last lesson we were only recording our changes locally, but we may want to have these changes be available remotely as well (for collaborating/sharing/backing up). The idea is you keep your local and remote repositories "in sync".
17 |
18 | This is straightforward in GitKraken and you do it by doing a one-way synchronization of your repository to the remote that you linked it to when you first created the repo. This one-way synchronization will **push** your repository from your computer to the GitHub website, and populate the *remote* repository on GitHub's servers in the process.
19 |
20 |
21 |
22 | We can now view our changes on our remote at GitHub.com. If the left pane, our remote is given the name 'origin', which is the default term for the remote repository in Git (note that you can call it whatever you'd like, and you can have more than one remote! But that is beyond the scope of this lesson.) If we then right-mouse click on our 'origin', we can select the pop-up menu option "View origin on GitHub.com":
23 |
24 |
25 |
26 | Indeed, GitKraken sends us to our web browser and our repository on GitHub.com is displayed:
27 |
28 |
29 |
30 | Notice that our commit short descriptions are shown here; and that we can see the different commits -- serial & coordinated -- that we performed.
31 |
32 | > You can also have a fully local repository, without a remote "synced" one on GitHub.
33 | > If you would like to initialize such a repository with this intention pick the "Local Only" option under "Init".
34 |
35 | ***
36 |
37 | **Exercise #2**
38 |
39 | 1. Push the changes to the "learning_github" repo (from the preivous exercise) to the remote repo on github.com
40 | 2. Make changes to data-file.txt on GitHub.com
41 | 3. Sync or "Pull" the changes that were made remotely to the local repository
42 | ***
43 |
44 | On Github, you can choose to keep it public or make it private; and if it's private, you can choose specific GitHub users with whom you want to share it or collaborate with. For this lesson, we will stick with having a public repository.
45 |
46 | Once your document is online, you can continue to make local changes to your file. But you will have to synchronize your local changes to reflect these changes in the published GitHub repository. GitHub stores changes both locally (on your computer) and remotely (on their servers), and it is important to keep these changes in sync.
47 |
48 | In GitKraken and standard Git workflows, this is accomplished by regular, intentional rounds of **Pull** and **Push**, which both **pulls** in changes from the remote repository, and **pushes** any local changes to the remote repo.
49 |
50 | ### Making Changes Remotely
51 |
52 | It is also possible to make a change to your repository on the web interface. We forgot to give attribution to our functions in the `util_functions.R` file. Go into the `code` directory, and click on the name of the file in the title area to take you to a new page showing your document.
53 |
54 | Click on the 'Edit' option or icon. You will now be able to edit the file and add some new text. Let's add comments to both the square function:
55 |
56 | ```
57 | # Square function
58 | # adapted from https://hbctraining.github.io/Intro-to-R/lessons/03_introR-functions-and-arguments.html#user-defined-functions
59 | # and https://www.r-bloggers.com/how-to-write-and-debug-an-r-function/
60 | ```
61 |
62 | and the Anscombe's quartet function:
63 |
64 | ```
65 | # Anscombe's quartet
66 | # Examples from https://www.r-bloggers.com/using-and-abusing-data-visualization-anscombes-quartet-and-cheating-bonferroni/
67 | ```
68 |
69 |
70 |
71 | Once you have made some changes to your file, you will again see the option to commit changes near the bottom of the text entry box.
72 |
73 |
74 |
75 | One can also add and delete files from the repo. Since we're working in R, let's remove the python code files. One must first view the file itself (click on the file's name) to reveal the Delete (trash can) icon. Click here to delete:
76 |
77 |
78 |
79 | This solitary action requires a description and subsequent Commit:
80 |
81 |
82 |
83 | Let's delete the other two as well. the `code` folder in your repo should look like the following:
84 |
85 |
86 |
87 | One can also add files and folders to the repo via the web interface. We'll keep this simple. In the `doc` folder we can add the `Pi formulas...` document from our workshop downloads folder. Navigate to the `docs` folder in the repo, and click on the Upload files button.
88 |
89 |
90 |
91 | This action also requires a Description and subsequent Commit:
92 |
93 |
94 |
95 | You should now see the `Pi Formulas...` document in your `docs` folder.
96 |
97 | Two important sidebars: since on GitHub.com file changes are done serially, coodinated file changes cannot be done here -- the must be done on your local machine with GitKraken. Also, all these changes are realtime on the GitHub remote -- Once you have committed these changes these changes are immediate.
98 |
99 | Let's return to our local machine. GitKraken has already noticed that our remote repo has changed, and the markers for the two repos (local and remote) have diverged:
100 |
101 |
102 |
103 | Click on the timeline entry to view the file changes:
104 |
105 |
106 |
107 | And click on the filename itself to see the changes made within:
108 |
109 |
110 |
111 | You can see from this view that we now have the text with changes highlighted in green and red. Red indicates where things have been removed, while green indicates additions.
112 |
113 | Click on the filename again to return to our commit timeline.
114 |
115 | To get all these changes back onto our own (local) computer, we need to Pull these changes back to our local repo, using the Pull button in the GitKraken toolbar towards the top of the screen:
116 |
117 |
118 |
119 | If all goes well, you should see a brief 'Success' message, and your repos should be in sync again:
120 |
121 |
122 |
123 | ## Viewing File Histories
124 |
125 | One very useful feature of this and other Git clients is looking at how a file has changed over time. In GitKraken, select the timeline entry 'Refactor code...', and in the section below, right-mouse click on the `scriptlets.R` file and select "File History" to see exactly that:
126 |
127 |
128 |
129 | Our code file is displayed with comments on the left and differences between the (left) selected and previous versions:
130 |
131 |
132 |
133 | Clicking on the previous comment shows the next level of changes:
134 |
135 |
136 |
137 | And finally, clicking on the File View button shows all the changes together, with the log (legend) of changes being indicated with color coding:
138 |
139 |
140 |
141 | Click on the X at the upper right to close this window and return to the commit timeline.
142 |
143 |
144 | ***
145 |
146 | Next: [Managing Conflicts](04_Managing_conflicts.md)
147 |
148 | ***
149 |
150 | * Materials used in these lessons are derived from Daniel van Strien's ["An Introduction to Version Control Using GitHub Desktop,"](http://programminghistorian.org/lessons/getting-started-with-github-desktop), Programming Historian, (17 June 2016). [The Programming Historian ISSN 2397-2068](http://programminghistorian.org/), is released under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
151 |
152 | * Materials are also derived from [Software Carpentry instructional material](https://swcarpentry.github.io/git-novice/). These materials are also licensed under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
153 |
--------------------------------------------------------------------------------
/02_GitKraken.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: "Getting Started with Git using GitKraken"
4 | author: "Bob Freeman, Meeta Mistry, Radhika Khetani, Kathleen Keating"
5 | ---
6 |
7 | ***
8 | Previous: [Introduction to Version Control](01_Intro_to_versioning.md)
9 |
10 | ***
11 |
12 | In this lesson the focus will be on gaining an understanding of the basic aims and principles of Version Control by working with a plain text document using Git (GitKraken & GitHub).
13 |
14 | ## Getting Started with Git using a GUI (Graphical User Interface)
15 |
16 | Usually when programmers use Git for version control of their code, they use the command-line user interface, i.e. a terminal interface from a UNIX/Linux OS. However, there are several tools that enable the use of Git easily for novices using a Graphical User Interface (GUI), enabling a point-and-click interface. Two examples of GUIs are [GitHub Desktop](https://desktop.github.com/) and [GitKraken](www.gitkraken.com).
17 |
18 | Although there are several advantages to using the command line version of Git in the long run, a GUI is a great place to start with learning about Version Control.
19 |
20 | > **A Note on Terminology**
21 | >
22 | > One of the trickier aspects of using Git is the associated jargon (`repository`, `add`, `commit`, `pull`, `push`, `remote`, `detached head`). Some of the commands/terms are fairly self-explanatory, others less so, and in this workshop you will encounter both of these. [Here is a glossary of associated terms](https://help.github.com/articles/github-glossary/), however it is best to pick up terminology while learning how to use GitHub.
23 |
24 | ### Register for a GitHub Account
25 |
26 | Since we are going to be using [GitHub](https://github.com/) we will need to register for an account at GitHub if we don’t already have one.
27 |
28 | ### Install GitKraken
29 |
30 | Most of you should have already installed [GitKraken](https://www.gitkraken.com/download). Open it, and sign in using the credentials you used to sign up for a GitHub account.
31 |
32 |
33 |
34 |
35 |
36 | > When connecting GitHub to GitKraken, make sure that the authorization is performed on either Chrome or Firefox and not on Internet explorer.
37 |
38 | Once you sign in, GitKraken will take you to it's welcome screen. At this point, you are ready to start working with *a repository*.
39 |
40 | ## Version Controlling a directory of files
41 |
42 | ### Creating a Repository
43 |
44 | ***So, what is a Git repository?***
45 |
46 | *"A Git repository is the .git/ folder inside a project (folder). This repository tracks all changes made to files in your project, building a history over time. Meaning, if you delete the .git/ folder, then you delete your project’s history."*
47 | -adapted from [https://blog.axosoft.com/learning-git-repository/](https://blog.axosoft.com/learning-git-repository/)
48 |
49 | Essentially, a (project) folder is chosen to be tracked and a Git repository is initiated within it; this ensure that the contents, and the changes to the contents within that folder will be "watched" by Git.
50 |
51 | A few salient features of repositories are listed below:
52 | * A repository can have many files and sub-folders (basically, a normal project folder)
53 | * A separate repository for each separate project
54 | * Do not create repositories for folders within a repository (avoid matryoshka repos!)
55 | * The changes made within folders with repositories are being "watched" by Git as mentioned above, but these changes have to be deliberately added to the repository in order to be version controlled or recorded
56 | * It can be set up to ignore some items in the folder (very large datasets, or temp files)
57 |
58 | Download the folder we have generated for this session [from here](../../raw/master/data/example_files.zip), and unzip it in a location of your choosing. We recommend placing it on your Desktop for the duration of this workshop.
59 |
60 | ### Creating a Folder/Repository, Starting from your Local Machine
61 |
62 | There are a number of different ways to add files/folders for Git/GitKraken to track.
63 |
64 | * **Click on the folder icon at the top left corner**. This will allow you to either *Open* an existing repository, or *Clone* a repository that you or someone else has created, or *Init* (initialize/create) a new repository.
65 | * Today, we will be initializing a repository within a new folder, **click on Init, and then GitHub.com**, so that we can create a repository that we will keep locally, *as well at a remote location* as a backup or perhaps for sharing:
66 |
67 |
68 |
69 | Fill in the fields as appropriate:
70 | * your GitHub account
71 | * the name of the repository. *Keep this to letters, numbers, and underscores; for this class, let's call it "gitkraken_workshop".*
72 | * add a description of what this folder/repository will contain.
73 | * set the access for the remote location, whether this should be viewable by anyone, or kept private to yourself and only people you add as collaborators
74 | * leave the "Clone after init" option checked. This will make the repository available to you on GitHub.
75 | * For the "New repository path", select a location on your computer where the newly created folder (with repo) should be placed using the Browse window. For this class, let's place the repo on your Desktop.
76 | * Finally, click on the "Create Repository and Clone" button.
77 |
78 | **Note: sometimes people fail at this step and they are confused as to how to proceed. FINISH THE INSTRUCTIONS LISTED ABOVE!**
79 |
80 | Voila! You now have your first Git repo!
81 |
82 | Our folder should now be visible on the top left and we will be able to see more information about it in the left column.
83 |
84 |
85 |
86 | We'll point out a few features here:
87 | * a list of known/open repos at the top left
88 | * a button/function bar in the top middle
89 | * a listing of the branches for your local and linked remote repositories
90 | * and then the commit (snapshot) message and files that are part of this commit
91 |
92 | Since we'll now want to add more files to this repository, right-mouse click on the `README.md` file and select "Show in Finder" ("Show in Explorer") from the pop-up menu:
93 |
94 |
95 |
96 | The folder we created the repository with now contains an extra folder with the name `.git` (this is a hidden folder). This folder is how GitKraken will track changes (adding files/folders, modifying existing ones, deleting files/folders) we make within our version controlled folder:
97 |
98 |
99 |
100 | > To view hidden folders in Mac OSX, you can press Command+Shift+Dot.
101 |
102 | ### Staging and Committing Changes
103 |
104 | But before we continue, we wish to utilize a few best practices from research data management: organize your files, using appropriate folder structure and file naming.
105 |
106 | 1. Let's start by creating 5 new directories: `code`, `data`, `docs`, `figures`, and `other`
107 | 2. Now, let's move some of the files into these newly created directories from the downloaded `example_files` folder. Move the files into the appropriate folders as shown in the image below. We won't be moving `Pi Formulas...`, `README.md` (since one is already exists in our new repo), and `util_functions.R`.
108 |
109 | When done with the moving, your new repo (folder) should look something like the following image:
110 |
111 |
112 |
113 | Now, when we switch back to GitKraken, you'll notice the timeline window at the top has changed. GitKraken has noticed files have changes, and it's indicated this new set of changes is considered "Work in Progress" (WIP):
114 |
115 |
116 |
117 | Click on the **WIP** line at the top to show the files it is watching, show in the bottom pane. You can resize this panel to show all the files if you desire:
118 |
119 |
120 |
121 | A **commit** tells Git that you made some changes which you want to record. Though a **commit** seems similar to saving a file, there are different aims behind ‘committing’ changes compared to saving changes. **Commits** take a snapshot of the file at that point and allow you to document information about the changes made to the document.
122 |
123 | We next need to tell Git that we wish to stage these files for a commit, what we call an initial commit, when we take a snapshot of the files at the start of our work and any tracking that we wish to do. To include or **add** these files for a commit, we **stage** all the changes by clicking on the "Stage all changes" button:
124 |
125 |
126 |
127 | You also have the option of adding only certain files to the "Staging" area if you wish to make separate commits. Simply click on the word Stage that appears near the files you wish to include.
128 |
129 | To commit changes **you must give a summary of the changes**, include an optional message, and click on the Commit button:
130 |
131 |
132 |
133 | After the commit, the timeline changes to reflect the current state & history of our repository. Clicking on the top line, our recent commit, shows in the bottom pane the changes that were include, which is the addition (green plus square) of these files:
134 |
135 |
136 |
137 | A useful way to think about commits is as the ‘history’ of your project. Each commit records a development or change made to the documents in your repository; the history of the project can be traced back by looking at all of the commits.
138 |
139 | * Think carefully about when to make commits, since the advantages of version control rely on taking snapshots of your changes regularly.
140 | * Make the commits "atomic", i.e. **commit a few related changes together**; this will help if you have to revert back to a specific version/snapshot.
141 | * Use meaningful **commit summaries** and **messages**, so that your messages/summaries are independently understandable by your collaborators and your future self.
142 |
143 | > **Note about Branches**:
144 | >
145 | > When you commit you will see ‘commit to master’. This refers to the **master** branch.
146 | >
147 | > Within a Git repository it is possible to have multiple ‘branches’. These different branches are essentially different (virtual) places in which to work. Often they are used to test new ideas or work on a particular feature without modifying or "contaminating" the master copy (e.g. production version of a webpage). This feature is very useful when collaborating with others. We do not have time to go into this aspect of Version Control today, but we encourage you to explore it further.
148 |
149 | ### Changing File Contents and Committing Changes
150 |
151 | We're going to make several sets of changes that reflect the flexibility and capability of a version control system.
152 |
153 | Let's open the `README.md` document using our favorite text editor (see note below about text editors) and make this more useful. The information in this document is displayed at the bottom of the main page of your repo when you view it on GitHub (online). The `.md` extension means that this is a text file in ["markdown" format](https://guides.github.com/features/mastering-markdown/), which GitHub automatically renders into readable HTML pages.
154 |
155 | > README files are an essential part of any analysis workflow, so that your future self or your collaborators are able to understand what they need to know. Git and Github encourage this practice for every repository. [Click here to learn more about README files associated with biomedical datasets/analyses](https://datamanagement.hms.harvard.edu/readme-files).
156 |
157 | Let's turn our `README.md` file for this Git repository into something more meaningful by added some boilerplate text and helpful information to the small amount of text already there:
158 |
159 | ```
160 | ## Overview
161 | Our code will demonstrate the different code snippets that have been used for programming
162 | classes. We will have this written in both R and Python.
163 |
164 | ## Installation
165 | The full suite of code will require the Tmisc and dplyr R packages;
166 | matplotlib and seaborn for Python
167 |
168 | ## Usage
169 | Simply fire up RStudio for trying out your R code, or Spyder for your Python code.
170 |
171 | ## Getting help
172 |
173 | ## Contributors
174 | Contributions and references are included in the source code files.
175 |
176 | ## References
177 | Contributions and references are included in the source code files.
178 |
179 | ## Licensing
180 | This is all available as CC BY 4.0 license. Enjoy!
181 | ```
182 |
183 | Save the changes to your file.
184 |
185 | Let's also open the `scriptlets.R` file. You'll notice we have some template text there as well -- great for reminding you what you need to do when starting to code. Let's also change the file to reflect the new example codes we've found. Copy & paste this code:
186 |
187 | ```
188 | #!/usr/bin/env Rscript
189 |
190 | # This script will include a collection of small scripts steps
191 | # often seen as example code. We're using this solely for demo purposes
192 |
193 |
194 | # 1. Prints hello world
195 |
196 | myString <- "Hello, World!"
197 |
198 | print (myString)
199 |
200 |
201 | # 2. Square function
202 | # adapted from https://hbctraining.github.io/Intro-to-R/lessons/03_introR-functions-and-arguments.html#user-defined-functions
203 | # and https://www.r-bloggers.com/how-to-write-and-debug-an-r-function/
204 |
205 | square_it <- function(x){
206 | sq <- x*x
207 | return(sq)
208 | }
209 |
210 | square_it(5)
211 |
212 |
213 | # 3. Monte Carlo Pi
214 |
215 | for (trials in 1:3000) {
216 | count = 0
217 | for(i in 1:trials) {
218 | if((runif(1,0,1)^2 + runif(1,0,1)^2) < 1) {
219 | count = count + 1
220 | }
221 | }
222 | print(paste(trials, ": ", (count*4) / trials))
223 | }
224 |
225 |
226 | # END
227 | ```
228 |
229 | Save this file as well, and go back to GitKraken. Again, the program creates a new **WIP** timeline entry as it has detected changes. Click on this WIP line to show that GitKraken has noticed that our files have changed, and click on the README.md (file icon with an ellipsis inside):
230 |
231 |
232 |
233 | When you click on the filename, you will see that these new lines of text appear; this lets us know that Git is able to see changes in your file but at the moment these changes haven’t been recorded in an official ‘snapshot’ of your repository. To do this we need to **add** (**stage**) and **commit** our changes, just as we did before.
234 |
235 |
236 |
237 | > **Text Editors:**
238 | >
239 | > When creating a plain text document, you will want to use a text editor like Atom, TextWrangler/Sublime Text (Mac) or NotePad++ (Windows) instead of Microscoft Word or the default text editors. You will also want to make sure that you save it as plain text. There are a [large number of free and paid text editors available](https://en.wikipedia.org/wiki/List_of_text_editors) to choose from. In a pinch, you can always use TextEdit (Mac) or Notepad (Windows).
240 |
241 | In the context of GitKraken when you **stage** your changes, it is similar to the **add** command on the command line interface. You can add several changes in the staging area, and only **commit** when you are ready.
242 |
243 | Since we wish to keep all the different types of changes as separate commits, we will stage and commit first the documentation change to the README file, and then the code change in the Rscript file.
244 |
245 | First, stage only the `README.md` file, and, as we did with our previous initial commit, include a change message, and click on the Commit button:
246 |
247 |
248 |
249 | Again, you'll see our timeline has changed to include this commit. Now also stage the changed code file, include a meaningful change message, and click Commit. Our timeline should now contain these two serial commits:
250 |
251 |
252 |
253 | There may be times, however, when we wish to ensure that we save a coordinated set of changes. For example, if we want to make coordinated changes to multiple files it makes sense to make the changes and then stage (add) and commit all together (**atomic commit**).
254 |
255 | Let's say we want to update the code in the `scriplets.R` file to the following wherein we want to use the `util_functions.R` in the code. Remember that the `util_functions.R` is the Rscript file we left behind in the folder we had downloaded.
256 |
257 | 1. Let's update the `scriplets.R` file with the following information and save it:
258 |
259 | ```R
260 | #!/usr/bin/env Rscript
261 |
262 | # This script will include a collection of small scripts steps
263 | # often seen as example code. We're using this solely for demo purposes
264 |
265 | # Put globals, installs, and sources here
266 | source("./util_functions.R")
267 |
268 | # Put functions here
269 | # 1. Prints hello world
270 | hello_world <- function() {
271 | myString <- "Hello, World!"
272 | print (myString)
273 | }
274 |
275 | # main code
276 |
277 | hello_world()
278 |
279 | square_it(10)
280 |
281 | montecarloPi(3000)
282 |
283 | # END
284 | ```
285 |
286 | 2. Now, let's move the `util_functions.R` script file from the downloaded `example_files` folder into the `code` folder in our new repo.
287 |
288 | When we return to GitKraken, it has noticed the two changes. Since the change in the main code file depends on the presence of this other file, we need to ensure this snapshot captures these dependent changes. So we stage both files, give a meaningful commit message reflecting this process, and Commit. Your repo should now look like the following:
289 |
290 |
291 |
292 | ***
293 |
294 | **Exercise #1**
295 |
296 | 1. Create a repository `learning_github` in GitKraken. Make sure to create it both locally, and remotely on github.com.
297 | 2. Find the folder on your local computer, and add a couple of small text files to it from your computer.
298 | 3. Create a new plain text file called `data-file.txt`, add a line or 2 of content to it and save it to the `learning_github` folder.
299 | 4. Go to GitKraken, and commit the change with an approriate message.
300 | 5. Switch repos back to the `gitkraken_workshop` repo.
301 |
302 | ***
303 |
304 | Next: [Remote repositories, managing conflicts](https://hbctraining.github.io/versioning_data_scripts/03_Github_remote.html)
305 |
306 | ***
307 |
308 |
309 | * Materials used in these lessons are derived from Daniel van Strien's ["An Introduction to Version Control Using GitHub Desktop,"](http://programminghistorian.org/lessons/getting-started-with-github-desktop), Programming Historian, (17 June 2016). [The Programming Historian ISSN 2397-2068](http://programminghistorian.org/), is released under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
310 |
311 | * Materials are also derived from [Software Carpentry instructional material](https://swcarpentry.github.io/git-novice/). These materials are also licensed under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/) (CC BY 4.0).*
312 |
--------------------------------------------------------------------------------