Keeping a history
- It's a good idea to keep a record of your work.
- Something you write may be a bad idea.
- So you get rid of it.
- Then it turns out to be a good idea.
- Then what?
Twists and turns of a crappy idea.
- Best case scenario: you just commented it out.
- Problem: you may have this a lot (I did) and your file becomes unreadable.
Twists and turns of a crappy idea
- Middle case scenario: wary of delete, you start a new file.
- Problem: you end up with a billion versions of your dissertation.
Twists and turns of a crappy idea
- Worst case scenario: you delete it from your .tex file.
- Problem: not much to do from here. Try to redo all your work.
- Learn to use , even if in just a basic way.
- keeps a history of your document within
that document.
- is free, with many open source tools to help.
How does it work?
- Works only on plain text files.
- Creates snapshots of your work, by comparing them to the previous state.
- You can save a new snapshot ("commit") whenever you want.
- Possible to go back to previous versions ("a previous commit") of your work.
Advantages
- Flexible version history of your work.
- It's smart: multiple users can work on the same file.
- Combined with git hosting services, you can store your work online.
- It's free!
Learn by doing
- Check if git is on your system.
- Open a terminal window, and type:
git --version
- If you get something like, the following, you're good.
Learn by doing
- You can use git from the command line, but you may want to install a GUI.
- Good ones:
Using Gitkraken: Benefits
- Open Source
- Works cross-platform
- Intuitive
- Looks pretty
How to git: brief
- Initialise a git repository (only once)
- Work on the file within
- Stage the file
- Write a commit message
- Commit the changes
- After 5. you have a recorded 'snapshot' of the file, which you can revisit later.
How to git: Initialise
- In Gitkraken:
- File > Init Repo
- or:
ctrl+I/cmd+I
How to git: Work
- Outside of Gitkraken
- Use LaTeX in the normal way
How to git: Stage
- Inside of gitkraken
- Click 'stage files'
How to git: Write
- Inside of Gitkraken: write a note specifying what this snapshot represents
- Be concise, but clear.
- Why is this snapshot useful?
- What happened?
- Effectively: if you ever need to revisit this snapshot: why is it a good one to go back to?
How to git: Write
How to git: Commit
- Finally, hit 'commit' to commit the changes to the snapshot.
Git: Further Benefits
- Sync to online repos: either Github or Gitlab.
- This is like a better version of dropbox.
- But, it is not automatic, so you must commit your changes and push them to the remote.
Syncing the repo to Github
- Connect Gitkraken to your Github account.
- Preferences > Authentication > Github > Connect to Github
- Click 'continue authorization'.
- Add in your login credentials.
- You're good.
Create a Github repo
Fill out info
- Tip: Initialise with a TeX .gitignore file.
Clone the repo
- File > Clone Repo
- Select 'Github.com'
- Specify location
- Select repo to clone
- Clone the repo!
Work, commit + push
- Go through the normal workflow.
- When ready to sync, click 'Push'