background preloader


Facebook Twitter

Git merge conflicts by DUONG Phu-Hiep on CodePen. I used Github for years.

Git merge conflicts by DUONG Phu-Hiep on CodePen

Most of my personals projects are on Github. However I'm only a amateur Git user who only knowledgeable enough to work with one-person projects. I suppose that many Github's users (or evens a majority of them) are like me. Now, I need to use Git in a team. Things become complicated: branches to merge, conflicts pop up, cryptic error messages or situations... I don't want to learn about the internals of Git.

After a few days playing around with git, experiment all sort of branching merging, rebasing, resolve conflicts. This article is not a tutorial, there is already many tutorials out there. Create a new folder git-playgroundIn this folder, we will simulate a team of 2 persons: "Bob" and "Dave" working on a project called "demonic" on a shared repository host. Create a shared repository in the host folder mkdir host; cd hostgit init --bare --shared demonic.git.

SubModule vs SubTree

Effective pull requests and other good practices for teams using github. I work at an agency where we pay $200 a month to Github for their platinum plan.

Effective pull requests and other good practices for teams using github

This article is a summary of an internal talk I gave on making the most of our subscription. There's nothing original here: it's just a collection of tips that I've harvested over the last few years. I'm publishing this article mainly so I have something to refer future employees to. Pull requests are an excellent tool for fostering code review.

If you're using Github for team projects, you should be using these extensively. Many people don't realise that you can make pull requests between two branches of the same repository (the so-called "shared repository model"). A good practice is for someone else to merge your code into the mainline, ensuring 2 sets of eyeballs review each feature. Sample workflow Here's a sample workflow demonstrating the use of pull requests. Work on a story Create a new branch for the current story you are working on: (master) $ git checkout -b feature/masquerading Ask for feedback Warning. Git. One of the topics that I didn't cover in depth in the Pro Git book is the reset command.


Most of the reason for this, honestly, is that I never strongly understood the command beyond the handful of specific use cases that I needed it for. I knew what the command did, but not really how it was designed to work. Since then I have become more comfortable with the command, largely thanks to Mark Dominus's article re-phrasing the content of the man-page, which I always found very difficult to follow. After reading that explanation of the command, I now personally feel more comfortable using reset and enjoy trying to help others feel the same way. Undoing Things. At any stage, you may want to undo something.

Undoing Things

Here, we’ll review a few basic tools for undoing changes that you’ve made. Be careful, because you can’t always undo some of these undos. This is one of the few areas in Git where you may lose some work if you do it wrong. One of the common undos takes place when you commit too early and possibly forget to add some files, or you mess up your commit message. Git Immersion - Brought to you by Neo. How do I revert all local changes in Git managed project to previous state? Git: fetch and merge, don’t pull. This is too long and rambling, but to steal a joke from Mark Twain Blaise Pascal I haven’t had time to make it shorter yet.

git: fetch and merge, don’t pull

Git Workflows and Tutorials. The array of possible workflows can make it hard to know where to begin when implementing Git in the workplace.

Git Workflows and Tutorials

This page provides a starting point by surveying the most common Git workflows for enterprise teams. As you read through, remember that these workflows are designed to be guidelines rather than concrete rules. We want to show you what’s possible, so you can mix and match aspects from different workflows to suit your individual needs. Centralized Workflow. Version Control Best Practices. Commit Related Changes A commit should be a wrapper for related changes.

Version Control Best Practices

For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other team members to understand the changes and roll them back if something went wrong. Svn - Why is Git better than Subversion? Code School - Try Git. About Version Control. This chapter will be about getting started with Git.

About Version Control

Working with Remotes. To be able to collaborate on any Git project, you need to know how to manage your remote repositories.

Working with Remotes

Remote repositories are versions of your project that are hosted on the Internet or network somewhere. You can have several of them, each of which generally is either read-only or read/write for you. Collaborating with others involves managing these remote repositories and pushing and pulling data to and from them when you need to share work.

Managing remote repositories includes knowing how to add remote repositories, remove remotes that are no longer valid, manage various remote branches and define them as being tracked or not, and more. In this section, we’ll cover some of these remote-management skills. Showing Your Remotes.