![]() ![]() If we have a chain of commits all in a row, we can draw them like this. When something contains the hash ID of a commit, we say that that something points to the commit. Most commits just have one single parent. Most of that metadata is just to show you when you look at the commit, but one piece of information is crucial for Git itself: each commit lists the raw hash IDs of its parent commits. This hash ID is, in effect, the true name of the commit.Įvery commit is made of two parts: its data-a snapshot of all of your files-and some metadata, information about the commit itself, such as who made it (your name and email address), when (date-and-time-stamps), and why (your log message). The way this works is actually remarkably simple:Įvery commit has a unique hash ID. ![]() These commits are formed into a graph, specifically a Directed Acyclic Graph or DAG. GitHub throws an extra wrinkle in here, too-or maybe, takes a wrinkle you want away, depending on how you look at it. ![]() I think I'm missing something about squash and merge. I didn't want all the commits from develop to move to master, which is why I did a "squash and merge", instead of rebasing. I assumed (wrongly ?) that 'squash and merge' would do a fast forward merge to prevent the divergence. To really "get" Git, you need to draw graphs To understand what you're doing, read on. The squash-and-merge made one new commit that contains the same work as the 28 earlier commits, so the one new commit is the new-and-improved replacement for those 28 commits. The idea is that after this squash-and-merge, you'll delete the branch name and give up all 28 commits forever. In any case, remember: this is the goal of squash-and-merge: to kill off the branch. If you are the only person using the GitHub repository, you can do whatever you like. There are many options, with different effects, especially on any other people who might be using the GitHub repository. The git reset -hard command will throw out any uncommitted work, so be extra-careful any time you are using this. This sequence of commands may fix it, but be very careful and make sure you understand each one: git checkout master It's then a different branch, even though it's the same name. You can then create a new branch, even one that's still named develop. You're normally supposed to just delete the branch entirely now. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |