GitHub Workflow - TREC-Agroecology/lab-wiki GitHub Wiki
-
Forks and clones - http://jlord.us/git-it/challenges/forks_and_clones.html
-
Fork a repo - https://help.github.com/en/articles/fork-a-repo
-
Pull request - https://help.github.com/en/articles/creating-a-pull-request
-
Token Authentication - https://gist.github.com/jonjack/bf295d4170edeb00e96fb158f9b1ba3c
- A Friendly GitHub Workshop
- Friendly Introduction to GitHub
- Reproducible Data Science: Version Control with Git
- Example repo
Danielcalza/introducing-agroecology
Fork Danielcalza/introducing-agroecology from TREC-Agroecology/introducing-agroecology
Open 'Terminal' or 'Git bash' for Windows (may require install; https://gitforwindows.org/); or 'Terminal' for MacOS.
Navigate to your desired repo location
cd Documents/GitHub_repository
Clone your forked repository
git clone https://github.com/Danielcalza/introducing-agroecology.git
Navigate to your forked repo
cd introducing-agroecology
Set up remote
git remote add upstream https://github.com/TREC-agroecology/introducing-agroecology.git
git remote -v
origin https://github.com/Danielcalza/introducing-agroecology.git (fetch)
origin https://github.com/Danielcalza/introducing-agroecology.git (push)
upstream https://github.com/TREC-agroecology/introducing-agroecology.git (fetch)
upstream https://github.com/TREC-agroecology/introducing-agroecology.git (push)
Pull from upstream to local branch master
git pull upstream master
- NB: Be on branch
masterfor thepullso as not tomergewith working branch
Make local branch my-work
git checkout -b my-work
Make local changes, git add <file_name>, git commit -m "<message>"
Push to origin from local branch
git push origin my-work
Create a pull request on GitHub.com
git status - reports branch and file changes
git log - reports recent commits
git branch - lists branches
git checkout <branch-name> - sets branch in git; changes made to local directory
git branch -d <branch-name> - deletes local branch
git push --delete origin <branch-name> - deletes remote branch
git cherry-pick - selects single commit to recover