Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 4.15 KB

File metadata and controls

51 lines (38 loc) · 4.15 KB

On the Use of Git

Git is a version control software created by Linus Torvalds (also responsible for giving us Linux). There are different commercial implementations of git. Even though, as some say, the time has come to give up GitHub, the following notes still refer to Github. There is also a lawsuit against Github which is motivated by Github building its success on becoming the repository of open source software development and then, as some claim, abusing the trust that open source developers brought to the platform. I had no time to look into Resources to Give Up GitHub myself yet, but if you want to try alternatives have a go.

New to Git?

Have a look at this tutorial. Let me know if there are problems or if you have other helpful sources.

Watch the video of the MIT Missing Lecture Series on Version Control (Git). (Btw, all of the series is highly recommended.)

Git best practices

I collect here some lessons learned from using git for assignments in various courses.

Proper use of git will be considered for grading. Depending on the nature of the assignment, complete solutions uploaded to the repo just before the deadline and not containing a trail of your work may not be accepted for grading.

  • Use the repo to create a trail of your work. Commit and push often.
  • Be careful about what you commit:
    • Do not track/commit/push machine generated files.
    • Avoid unthinking use of git add *. Only add files that should be tracked.
    • Run git status. If you see under Untracked files names that you don't recognize, they are likely machine generated files. Do not track those. Rather add these names to a file named .gitignore at the root of your repo.
    • Build up your .gitignore incrementally using git status and add files you do not want to track to .gitignore step by step. You can start from my .gitignore file in this repo.
    • Meaningful commit messages will help yourself and collaborators.
  • Do not create different versions of files by copying them. Use branches for collaborative projects in which you and your collaborators want to work simultaneously but independently on the same project. Branches can be merged later.
  • Delete files only in exceptional circumstances. (Btw, even deleted files will remain accessible via the history.)

Further reading

The links below are written for more complex projects than a typical assignment, but it cannot harm to have a look:

Some commands