Workflow for updating vaccines
- Fork if you want your own copy without needing to collaborate -- you can choose a different path (fork in the road).
- Clone if you want to collaborate -- you'll need to worry about branches if you want to push to origin
- Note to self for this in-class demo:
- make sure I'm not going to add this stuff to my current repo
- I'm going to work in a directory that I'll call "junk"
- check my .gitignore and execute the following if "junk" is not already there (only needs to be done once)
echo junk >> .gitignore- you could do this with a text editor, but it's quicker (with linux & Mac) on the command line
Get a local copy of the repo
git clone https://github.com/ds5010/vaccines.git
cd vaccines
Note: you may want to .gitignore this repo before you cd into it
Create a new branch for experimentation
git branch
git branch pbdev
git checkout pbdev
git branch
git checkout main
git branch -d pbdev
Note: Forget the syntax? Try googling "git delete local branch" (sfo post with 20k+ votes)
git checkout pbdev
- Edit a file (README.md in this case)
- Before commiting the change, nothing looks different from the main branch...
git diff pbdev main
- Commit the changes in pbdev
git add README.md
git commit -m "Updated the readme"
- Merge an entire branch
git checkout main
git merge pbdev
- To merge only one file and then compare
git checkout main
git checkout --patch pbdev README.md
git diff pbdev main -- README.md