top of page

Have you had your “Oh git” moment yet?


ree

Have you ever had that “Oh git” moment, you know, that time in a project where the deliverable is due to a client and something unexpected occurs to the output after a data refresh over the weekend? It is usually followed by a sigh of relief because git is being used to manage the project and saves the day with its version control features that work like magic. Hopefully you have had an “Oh git” moment and not its sinister opposite, but just in case, here’s a quick git overview. Git is a free, open source platform that provides Source Code Management (SCM). SCM is synonymous with version control and provides a way to track changes made to source code, while keeping a running history of those changes. Those days of manually maintaining backup copies, appending versions to file name ad nauseum are a thing of the past. Being that all changes are tracked, it is quite easy to revert back to previous versions, and more beneficial, test any changes made to source code prior to adding it to the main source code. This is made possible through git’s awesome branching methodology. So, where do we start?


For those command line gurus, git is very easy to install on Linux while Git for Windows allows easy installation on Windows and provides a git-supported shell (command line) via git bash. Both versions are easy enough to follow and implement, and there is also a wide-range of tutorials and “how to’s” some of which we’ve provided below. For those who navigate towards using a Graphical User Interface (GUI) to do the heavy lifting, GitHub Desktop answers the call and comes with versions available for both Linux and Windows. There is also a vast amount of reference material to explain GitHub Desktop functionality.

What makes git so easy to understand is its branching design concepts. Similar to how a tree has branches that grow away from its trunk, a project has a branch that grows from its base. The difference in git is that the branch at some point merges back to its base after some change has occurred. The terminology commonly used to explain these actions in git are: "create a branch," "commit a change," and "merge a branch."

ree

Let’s take a step back and look at the concepts of git which allow it to “save our bacon” when things go wrong with our edits.


Commits

Every time you make a change to a file tracked by git, it’s up to you to log that change into git’s database of changes. Also, you can log changes to more than one file at a time when these changes are closely related to one another. How git knows that these changes over various files “go together” is when you tell git by grouping the changes into a git structure called a commit.

The Trunk

Any effort on a project which changes files tracked by git over time shows up in the change history in git as a series, or “chain,” of commits. This chain is called a branch. Branches have a name, or label, so we can differentiate between them. There is a special initial branch, usually called “master” or “main” that is automatically created for you when you tell git to start tracking changes in a directory.


Branches

New branches can be easily created, starting from any commit on another branch (e.g., the main trunk) to explore any variant of the files (from that point in time), like a feature change, a bug fix, a what-if experiment, and so on. When the changes on the variant branch “check out,” they can be incorporated into the main trunk; otherwise the branch can be saved (i.e., “this might be a good idea for the future!”) or it can be easily discarded. This branching concept is made all the more crucial when other people are changing the project files, not just you.


Time Machine

ree

So branching sounds like a great idea, but what if you want to switch from a feature branch, back to the main (trunk) branch? What happens to the current state of your project files? The nice thing about git is that when you switch branches (via the checkout command), it takes care of putting your files in the state that you last committed them on the target branch. And it happens very fast! And since a branch label is just a simple pointer to the latest commit on that branch, you can create a branch label on any commit in the “past,” and when you checkout that branch, your files revert to the content at that point in time, making git act as a time machine!


Another way to recover the state of a file at some point in the past is to tell git that you want it to show you (via the show command) file such-and-such name at commit such-and-such time.


Collaboration

So far we’ve been talking about how git manages your project’s file changes as if you were the only one working on the project. Git’s history of changes, in that case, is stored in a special directory on your local machine’s drive. To start collaborating with other people, git has the clone command which makes a copy of your project’s change history (called a repository, or repo for short). You could then pass this copy to another person, but this manual process is cumbersome. Thus, git allows you to post the copy of your repository to a server that is accessible by your teammates. This is called the remote repository, or remote for short. Your teammates can then obtain a copy of the repository from the remote via running the clone command on their local machine. After cloning, any changes made by teammates working independently of one another (by logging commits on their respective local repos) can be coordinated via pushing to, and pulling from, the remote repo.


Collaboration Services

You may already know about well-known internet-based service offerings that help your team store remote repositories and allow your team to interact with them. Among them are: GitHub, GitLab and Bitbucket, but there are several more, including self-hosted options, like Gitea and gitolite. They usually offer more than just a mere store for your remote repositories, like: forking (which is like cloning but happens on the server from user account to user account), issue tracking, discussion threads, wikis, project web pages, access to remote continuous testing, etc.


Merging Changes

With the idea of one remote and multiple local repos, git allows for team collaboration of changes such that one person’s changes can happen simultaneously with another’s, along parallel lines of effort. When more than one person’s changes need to be incorporated into the main trunk (base), they have to be serialized on the trunk, and any conflicting changes, if they exist, need to be resolved. This process is called merging.


A great feature found in most commonly used web-based git collaboration services, like GitLab and GitHub, is the ability to incorporate a commit review process in which a collaborator requests permission to merge changes in a branch into the main trunk (base). In GitLab this is done by the merge request feature, while pull request is used for GitHub, both allowing the assignment of reviewers to those changes. There is nothing like an extra set of eyes on your work!


Workflow

The main “trunk” is usually where all these changes are logged, after they are reconciled to one another as a result of the merge process, but your team can use whatever git team workflow makes sense for them. Git doesn’t enforce a workflow; it just gives you the low-level tools to manage changes quickly and effectively.


In Closing

May your project experience be filled with plenty of “Oh git” moments.

Here are a few sites we recommend and please keep a lookout for additional blog posts discussing more project-related concepts:

-"Introduction to Git: A Talk by Scott Chacon,” https://www.youtube.com/watch?v=xbLVvrb2-fY



-“GitHub,” https://github.com




ree


Roque Graciani

Roque is a Senior Operations Research Analyst. You can contact him at rgraciani@canallc.com.



ree



Rick Hanson

Rick is a Senior Operations Research Analyst. You can contact him at rhanson@canallc.com.


42 Comments


vn88ku
Oct 15

VN88 cuốn hút triệu người bằng Bắn Cá khám phá thủy cung, Tài Xỉu dự báo sắc bén, Bầu Cua vui nhộn hội hè, Đá Gà gay cấn đối kháng. Giữa mê cung link giả, VN88 KU – đại lý – canh giữ như hải đăng, mang lối vào bảo mật tối ưu. Nắm mẹo nạp rút tiện ích, khuyến mãi "nóng ran", cập nhật sôi sùng từ nhà cái. 


Like

FUN88 KYC
FUN88 KYC
Oct 09

FUN88 mang sức hút khó cưỡng qua đường link FUN88 KYC, nơi bóng rổ NBA gặp gỡ trò chơi bài blackjack chiến lược. Chúng tôi luôn cập nhật xu hướng để mang đến trải nghiệm mới mẻ và thú vị. Đăng ký hôm nay để nhận khuyến mãi khởi đầu, tận hưởng tỷ lệ thắng cao và ưu đãi độc quyền dành riêng cho thành viên mới.


Like

W88 VT
W88 VT
Oct 07

W88 - chìa khóa mở ra kho tàng cá cược đa dạng, từ đua ngựa gay cấn đến slot machine rực rỡ. Đăng ký nhanh chóng để nhận 200K tiền thưởng, tận hưởng hỗ trợ tận tình 24/7. Đây chính là nơi đam mê gặp gỡ may mắn, chờ bạn khám phá.


Like

MagicWin India offers a seamless and secure platform for both new and experienced players. The step-by-step guide on the MagicWin login process is incredibly helpful, ensuring users can access their accounts effortlessly. With a wide range of games and betting options, it's clear why MagicWin is becoming a top choice for online gaming enthusiasts. Highly recommend exploring their offerings


Team Magicwinind

https://magicwinind.in/ 

Like

Tham gia M88 qua link đáng tin, nhà cái châu Á nổi bật với bonus cược miễn phí và odds hấp dẫn. Dịch vụ chăm sóc bet thủ chu đáo, giao dịch an toàn. Đăng ký hôm nay để nhận quà tặng và khám phá thế giới từ bắn cá đến live dealer.


Like
bottom of page