All Posts

Explore all articles from Life Beyond Fife - Page 9

git

The inner cycle

While actively writing code and experimenting with possible solutions, it's crucial to be constantly committing code to your local git repo. By doing so you ensure you can safely undo botched attempts you might develop along the way. Indeed, this gives you the freedom to try outlandish things knowing you can easily revert to the original without needing to rely on <Ctrl>+Z in your text editor. The git commands Anytime you're happy with a small increment of coding, you can commit your changes to the local git repo. This coding increment can be of any quality you wish; it can...

2 min readRead more →
git

The middle cycle

The middle cycle helps reduce the complexity of your final commit. This daily task is to pull the latest changes from the origin repo to your git repo and merge them locally with your work in progress. Therefore, when you're ready to persist your changes to the master branch on the origin repo, many of the potential merge conflicts will likely be resolved for you by git because the task has been broken up into smaller chunks. The git commands The developer begins by completing one or more repetitions of the inner most cycle. Once some time has elapsed and...

2 min readRead more →
git

The outer cycle

The outer most cycle represents a full development task loop beginning with getting the latest code from the origin repo; developing, say, a new product feature or bug fix; and ending with creating a pull request for your changes so that they're available to your development collaborators. Your feature may take only a few hours in which case the cycle completes quickly, however, out of consideration to your colleagues if nothing else, you should break your changes into small, standalone merges that do not take more than a week to develop. The git commands First checkout the master branch. $...

2 min readRead more →
git

Setup: the origin repo

When beginning to collaborate on a coding project using git, there are a couple of steps to create a local copy of the repo. Assuming you're joining a project that's already underway, use the git clone command to create your own local copy. In the same way that master is the default name for the main development branch, origin is the default name for your shared repo server. $ git clone https://your-repo-hosting.com/repo-name.git You now have the master branch on your local machine, with a link to http://your-repo-hosting.com/repo-name.git as your origin repo. To verify the origin repo is what you expect,...

1 min readRead more →
git

Cycles: the introduction

There are three development activities that cycle repeatedly within each other. They can be done as often as you like but we introduce a best practice upper bound of one hour, one day, and one week for each. These durations are of course advisory and can be ignored, but discipline in this regard will reward you with increased productivity and more streamlined cooperation. Alongside each cycle there are associated git commands that allow you to complete the required steps. The Three Cycles The outer most cycle represents a full development task loop beginning with getting the latest code from the...

2 min readRead more →
git

Never, EVER, push to master

Every repo, after an initial commit, starts by default with one branch and that is named master. It's the branch that everyones' branches get merged into and is largely the one from which developers pull changes. This makes it the most important – it's the one that contains the latest changes, it's the one that's used by the build servers to power continuous integration. Therefore it needs special protection to ensure nothing bad happens to it. Tools and process Firstly, there should be safety measures in whatever git server hosting you use (GitHub, GitLab, BitBucket) to protect a master branch...

1 min readRead more →