All Posts

Explore all articles from Life Beyond Fife - Page 10

git

review with status, diff and log

Once you have staged all the changes you want to make (see add, remove and reset), you're ready to commit those changes to the active branch. This is how you collect all your development activity into a single atomic unit that delivers one feature, or fixes one bug etc. and passes all unit and integration tests, naturally. But before rushing in, review the changes you want to make using the helpful git commands log, status and diff. Right branch The log command gives a history of the branch you're working on an shows the previous commits that have been made...

1 min readRead more →
git

add and remove (rm), checkout and reset

Git is a stickler for detail, but helpfully so. It tries not to do things unless you specifically tell it to. So if you make changes to the codebase, git won't include your changes unless you explicitly tell git that it's intended. For example, say you add a new file called myProg.c to your codebase, or edit an existing file called myProg.c, the intended change must be signalled to git using the add command. $ git add myProg.c Thankfully, git lets you add whole subdirectories easily enough with the add command so you can do multiple files in a one...

2 min readRead more →
checkout this branch
git

checkout this branch

Welcome to one of the most easily confused git commands there is: checkout. Many people use the phrase, “Checkout the code” to mean “retrieve the latest copy of the code from the origin repo.” This is not the case (you retrieve the latest copy of the code with the pull command – see push and pull). [](/images/originals/05-gimp.png)As mentioned previously, any new independent work is added to its own branch and these are pushed and pulled to/from the origin repo. The checkout command is how you move from one branch to another. Only one branch can be active in git at...

2 min readRead more →
push and pull
git

push and pull

The state of a codebase on a git server, whether an origin repo in a server or on someone's laptop, is represented by one or more branches. A commit is a self contained set of code changes (modifications, new, moved and deleted files) made by one developer. A branch is a chronological series of commits that stretches back in time from the most recent change to the beginning of the codebase i.e. the very first commit. The main branch that contains all developers' commits is named master by default. The word branch is appropriate as it fits with the tree...

2 min readRead more →
init, clone and origin
git

init, clone and origin

Hopefully you, and the powers that be at your company, are convinced: git is the future and the way forward. We now begin the journey of understanding the ways in which git is different to server-client VCSs. We assume the user has already installed git and is familiar with navigating directories using the command line. init A git server can hold multiple code repositories known as repos. The simplest way to get started with git is to create a new directory with an empty repo. $ git init MyFirstRepo Congratulations. You created a git repo to hold the version changes...

3 min readRead more →
git

End to Big Bang commits

No matter how agile we get, or small and isolated we try to make our changes, collaborative development will always leave us stepping on each other's toes. When there are big changes to the codebase to be made by multiple developers the key to victory is to selfishly make sure to get yours committed first, otherwise be left open to a three-way merge from hell. Git allows programmers to break-up the merge process into smaller manageable chunks. Having the power of the server on your client means that you don't have to wait until your commit is ready before merging...

2 min readRead more →