title | author | date | output | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Welcome to the Wonderful World of `git` |
Simon Goring |
23/10/2020 |
|
git
is version control- Each change is recorded, all past versions are retained
- One version always works (more or less)
"
git
really changed the way I write code. I stopped making a whole bunch of huge changes, and started working on one thing at a time. It's made fixing my code a lot easier, and I don't run into problems as often."
Simon Goring (when I'm feeling optimistic)
- Changes to files are important and done with purpose
- We record changing files and the reason for these changes
- Changes may not always be wanted; we want to undo unwanted changes
- We want a clear way to collaborate and understand when changes conflict.
- A project that is managed with version control is called a repository
- Each snapshot of the repository at any one point is called a commit
- A repository can have multiple versions of the same code, called branches
- There is generally a main branch (see GitHub's explanation for deprecating master)
- New features often get their own branch until they are ready to be added to main
-
git
is the most common version control system -
git
is a command line utility -
git
watches files in your repository, it can also ignore certain files.gitignore
files are language/project specific; a long list of.gitignore
files
- GitKraken (free/paid, Proprietary)
- GitHub Desktop (free, MIT)
git
GUI (comes withgit
)- The
git
list of platform specific tools - RStudio, Visual Studio Code functions.
- Initialize (set up the infrastructure)
- Edit your code/document &cetera
- Stage the changes before we commit the changes
- Commit the changes to
git
Source: sublimegeek
git init
- Initialize a repository- Make changes
git add
to stage changesgit commit
to commit changes
Check your version.
simon@partyLaptop:~$ git --version
git version 2.25.1
simon@partyLaptop:~$
simon@partyLaptop:~$ git init
- Support greater collaboration
- Acts as cloud backup
- Provides secondary services (GitHub Pages, Project boards, Issue trackers)
- A large number of options exist across service levels & cost
- Wikipedia provides a comparison table of Source Code Hosting platforms
- We will focus on Github because of SJG's familiarity with the platform
- Your remote repository is the
main
version and theorigin
- remote is the backup, the collaboration hub & the authority
- local is where you work on things
- You can fork someone else's repository to your account
- You can clone someone else's repository (or your own) to your local computer
- You can create a new repository
- Create new Project in RStudio "From Version Control"
- All files copied locally. Fun times!!
- Active work
- Explore Github
- Fill in a couple lines here: http://bit.ly/githubrepos
- Active discussion