Collaboration with Git

Posted by Praveen on January 21, 2023 · 3 mins read

This small tutorial briefly gives and minimal idea about git and its usage.

Prerequisites:

  • Valid github account
  • git installed machine

In Ubuntu, install git by the command sudo apt install git

In windows, download the installer from here. Run it with administrator privileges. Accept the default values and choose Windows Command Prompt for accessing git.

Verify the installation by git --version

Once you installed git define global username and mail ID from termianl or commad prompt.

git config –global user.name “Your Name”
git config –global user.email “your@mail.id”

Working with la-tut repository

  • Go to your desired folder and Open terminal here. In windows SHIFT + RIGHT CLICK give the option Open Comamnd Prompt here.
  • Type git clone https://github.com/prvn-pa/la-tut.git
  • Now there should be a folder called la-tut
  • Open that folder and you may see a README.md file along with someother folders.
  • Open the directory with your name and place your files there.
  • There will be a sample README.md file in each folder. You can add your notes to that file.
  • The README.md will be loaded with examples. You can simply modify that to produce desired output.

Adding LaTeX files

  • Like working in normal folders, you can add any number of folders to files inside your folder.
  • You may compile the source in that folder itself.
  • Once you’re okay with your file do the following:

Adding the files to Github repository

  1. Type git pull --all. This will update your local folder, if any files are added by other users.
  2. Then, git add -A
  3. And, type git commit -m 'SOME HUMAN UNDERSTANDABLE MESSAGE HERE'
  4. The message can be something like ‘Initial files added’ or anything you wish to mention
  5. Now push it to the server by git push origin master
  6. A prompt will ask your Username and Password, then the files will be added to the main repository.
  7. You may check it with the command git status or directly view in your github account in browser.

Note

  1. Not only latex any files can be added to the Github repository.
  2. Often text based files are preferred due to their small size and accessible from any machine.
  3. But if you wish to add MS PPT or anything simlar to that you can do that.
  4. Push even the small changes. So, if something happen to your local repo you can pull from the server.
  5. And in the worst case some error happend delete your local repository and pull it from the source.