DEV Community

SparkedScience
SparkedScience

Posted on

Git and the two abstractions

Git in a collaborative environment

So...Git.
Might as well jump right in with Git and GitHub repos. The video goes in depth about the how, but we're going into the why and implications for teams here. Buckle up. (I'm tired)

Terminal

Easily the most difficult way to use Git. The default commit message editor is Vim, and there is no help for a mistake. Probably favored by experienced programmers and automations, this allows better control over commits and pushes. I find the automation aspect to be helpful. In one of my repos for web development, I created a Cron job to download (pull) any new code from the repo every night at midnight. If my development studio was on the same machine as the server, this would be overkill. But, when the server is on a different machine than the development tools, this is useful, as in my case. My code runs in a shared hosting environment. Having the Cron job ensures any changes made locally are moved to the production environment. NOT RECOMMENDED FOR PUBLIC USE. Actually dangerous. If a change is made that breaks the program or creates a vulnerability, but the workday is over, then a team can push that code and create problems. For a development fork, this is a great idea, as there will always be a backup of the code. Frequent merge conflict will occur though. Rant aside, the command line is good for more experienced people. Moving right along

Abstraction #1: GitHub Desktop

The desktop app provides an easy alternative to the browser version. Graphically superior to the command line, it is easier to use for beginners. I do not use it as often as I favor the next option, but we'll still talk about it. The desktop app is very similar to the browser version in almost every regard, except that you have to pull changes manually. I don't have a rant for this one. Just an all around decent option.

Abstraction #2: PyCharm or any IDE

By far the most used abstraction on my machine. With the power of the IDE and the abstraction of GitHub Desktop, it is the best option in my mind. Any development happens in the IDE, and the GitHub plugin offers enough of the same abstractions as GitHub Desktop to push and pull code. It is build right into the editor, and basic commits can occur without leaving the application. My favorite out of the three, although it takes away many features outside of pushes, commits, and pulls from inside the editor.

Collaboration

When working in a team, the Terminal version of Git is overkill and confusing for anyone. GitHub Desktop or the web version is perfect for project managers or non-technical employees who need to see the project. The graphical representation of many functions and settings is perfect for these roles. Developers would favor IDE plugins for ease of use and a simplified workflow.

Version control

One last note about Git and collaboration. Each commit generates a new hash, which can track changes over time. This is viewed easiest on the web client. GitHub keeps detailed records of each commit over time, allowing companies to roll back versions if a server breaks from a commit or if old code was lost and is needed again.

One final word, use Git. It'll. save your job.

YouTube video

Just a simple video demonstrating three ways to push code to a repo.

Top comments (0)