Although Git is a very powerful tool, I think most people would agree when I say it can also be... a total nightmare π I've always found it very us...
For further actions, you may consider blocking this person and/or reporting abuse
Awesome visualizations as usual!
It's interesting there's a few different syntaxes for selecting a previous commit:
Good idea to add that! I'm thinking of generally creating a "cheatsheet" format that also covers all that stuff :) Will do in the next one or when I update the format π
Came here to comment specifically along these lines - I can never ever remember what the difference between
HEAD~2
andHEAD^2
is !Had completely forgotten about
HEAD@{n}
syntax :DNice visualizations! What do you use to create them?
I'd love to know the answer to that too! :)
Lydia answered in another post of hers, which I recommend myself, that she used Keynote (the presentation software by Apple) to make the animations and then screen-recorded the slides.
The Post is "JavaScript Visualized: the JavaScript Engine"
Lol! Her profile description has the asnwer. :P
Thanks for clearing that up
Awesome animations. It is great to see a diagrammatic representation of these git commands.
For "git pull", is the animation correct? I would have expected it to fetch the commits and then do a ff merge.
For clarity, it would also help to distinguish between the remote repository and the local remote branches in the animations.
I also expected the ff merge. But now she already has an animation for
git pull --no-ff
if ever she needs one. πAmazing article Lydia!
I prefer to use Git in terminal as opposed to a GUI like the others on my team so I can face my Git fears. However, most of the documentation I read online is very complicated. Yours is the first long-form article I got to the bottom of and didn't have 2X the confusions as when I started!
Please write more Git visualized articles. I'll devour them, I swear.
Wow! Never knew about something like Reflog! Thanks for your efforts π€
Beautifully done! Seeing
rebase --onto
visualized would be great too π.Thanks so much for this awesome post. I have one question is that for this paragraph
"""
This example shows rebasing on the master branch. In bigger projects, however, you usually don't want to do that. A git rebase changes the history of the project as new hashes are created for the copied commits!
"""
You rebase the dev branch over the master branch. But you said in bigger projects you don't want to do that. I'm a little confused here. So in a bigger project, what do we do? Do we rebase the master over other branches? Thanks!
When you rebase your branch from a different commit on master, you rewrite the history of your branch. This requires a force push. If there are multiple developers working on that branch, this may cause issues if they have work based on the old history of the branch. Rather than doing a rebase, merging master into the branch may make more sense.
thanks so much for the reply. You mean a force push, do you mean the newer stuff on my branch will be pushed to the mater branch? I'm pretty new so sorry for the dumb questions. Thanks!
TL;DR: Master is unchanged in the process of this rebase example, only the branch is changed.
In the given example, the branch is being based off a different commit than it originally was. In other words, the commits made on master since the branch was originally made will now appear at the start of the branch's history. You will often see this referred to as "replaying commits". The branch commits will have a different hash (you can see this in the example if you look closely), but will have the same contents in them.
git rebase
can also be used to "replay" the commits from the dev branch back onto master, but I'm not as familiar with that work flow, so I won't try to give advice on it.Thanks so much for the awesome reply! Now I understand the flaw of doing this and a better understanding between 'rebase' and 'merge'. I really appreciate it!
I have one question.
For example, I am working on the dev branch. Meanwhile, my colleague has pushed 2 more commits.
What should I do? Should I pull first then commit or should I commit first and then pull?
I am always confused over here.
You cannot pull before commit because git does not know what do with changes in local.
This is what we do.
if you dont want to commit ur changes and still you want to pull data you do stash
stash will push changes to stack and you can get it from it later or you can auto stash
git pull --rebase --auto-stash
Thank you so much for the answer. Very Helpful!
Great post, @lydiahallie ! I'll definitely be using this to help team members in the future.
A few thoughts:
reset --mixed
(default), but an animation would have been greatrebase --onto
, would have been really informativeThanks again for the awesome resource!
TheAvocoder back with another masterpiece. ππΌ
thank uu π₯π
Nice read. One note though about rebasing is that we can still run into conflicts just as we do with merges.
I agree. Here, the article is misleading.
Very clarifying, the visualizations I wish where there when I first learned Git.
2 tiny text issues:
Keep up the good work!
Amazing work Lydia....Extremely helpful for all dev peeps.
I can read about these basic commands many times a year and each time learn something new and refresh what I have forgotten. Thanks for the great article!
Is it true that we can't get merge conflicts while rebasing? Because I am positive I faced some merge conflicts while rebasing. It would be great if someone could explain when and why would that happen?
Really awesome!! Thank you.
Do you think you could make an animation of
git pull --rebase
π? I would like to show it in comparison togit pull
.pull is fetch + merge
pull --rebase is fetch + rebase
Very useful!
You really are the lost supergirl. Thank you super champ. :(
Such a nice visualization!!! Thanks a lot. It helped me a lot to better understand git commands. Would you mind if I translate it in Korean and repost on my blog? I will leave the original link of course :)
wooow! amazing :) very good job
This is interesting, Thanks for this post :-)
Added in my reading list
you are superstar!
Thanks for the explanations. I really need to start using Git, but I keep putting it off.
Very good post!
Can you please add
git merge [branch] --strategy-option ours / them
and
git rebase [branch] --strategy-option ours / them
Thanks!
I like it.
This is very cool. Really love the visualisation.
What tool did you use to make those visualisation?
Great job!
In the animation for Pulling, shouldn't the 2 commits (7e456 and efi81) get copied over to the left side?
Awesome. I wish we could see this visualization on our actual git repository.
Is there any way ?
How to make the figures? Itβs really impressive
No doubt, the best tool is vi to resolve conflicts. π Your animations are excellent again, thanks a lot
These visualizations are π₯π₯π₯
Great post!
Awesome article. Thank you so much
Very good !!!
A Great Blog.
I have a very quick question, how can I design such cool animation . can you recommend to me any software or website that would be great. thanks.
Git is my home :)
Hello, I would like to republish this article of yours for my blog, there is no business use value.
omg this is so useful thank you
oh wow
How did you created the animation?
I really like what you did with squash where files were brought into the same commit. This would be cool to do with most all of them. Like reset and reset hard.
nice article
Really great explanations!
Hi! What program do you use to make the images/gifs for these posts? It's awesome! Been searching around and can't find any info on it, I would really appreciate it. Thanks!
This was great! I've ploughed through git tutorials and so on before but this visualization thing makes it seem all-so-simple! I dig it, thank you!
What tools do the Git interactive operation use?
Amazing stuff Lydia Hallie. Your blogs are really helpful. Keep up the good work. ππ
Many Thanks, great visualizations .
Thanks for the visualizations!
Used this cheatsheet ohshitgit.com/ for some situations with git, but it's always better to understand
Very helpful
Thanks!
Hi Lydia
Awesome post.
Which tool or service you use to create visuals?
Been using git for a very, very long time. This is absolutely the most helpful thing I've seen so far!
Awesome tutorial and great visualisations!
Thanks Lydia!
How do you make these cool animations? ( If its not a trade secret Would love to learn π )
Great post with so nice and clear visualizations. Thanks
Photos & animations are always vivid to understand! Very impressive~
Cool, this is very usefulπ
Fantastic post!
Thank you for the visuals and explanations. This is exactly what needs to be covered in a computer science curriculum. Great work as always!
I created an account just to tell you how much I appreciate this post.
Visualizing these commands is super helpful.
Bookmarking this page :)
I'm one of the many(?) who only learns more about git when something goes wrong. Your animated post was great! I may actually know more ahead of my next problem!
The best explanation I have ever seen. Congratulations!
WOWοΌοΌοΌ So Amazing, thank you so much
Really nice illustrations.
Definitely going to use this when bringing newcomers up to speed on Git.
Only niggle is that rebasing will give you exactly the same conflicts as a merge would have.
Good Job, pretty clear and handy!
Awesome piece! How did you create the visualizations? I'd love to create my own for software documentation.
amazing post !!!...it made many things clear .. thanks!
thanks for the great article. I always have confusion and now I AM CLEAR.
Really, really nice work. It's one of the best git tutorial/cheatsheet I've seen!
Thanks for an amazing article Lydia.
Which tool do you use for coming up with these amazing visualizations though?
Great post
..reset moves HEAD to the specified commit..
I think it should be reset moves the branch that HEAD is pointing to
I wonder what changes in the tasks of the project corresponds to all this hell?
This is a really good guide, awesome work, thanks!!
Quite the informative piece, Lydia! I shared it in our Telegram newsletter/channel for devs. ππΌ Link
This article is amazing. I'll share it to my mates. Thank you for bringing all these together! Well Done!!
@lydiahallie Awesome visualizations π I'm always curious as to how to create visualizations (especially for CS concepts) like animations etc with ease. How do you do it? Any tools you would recommend?
The writing is very good, especially the animation effect. May I ask, what is this dynamic picture made of? Can you recommend it? Thank you very much!
Can I translate this post to Koran at my blog? It's really awesome and usefull!
What tools do you use to make these visualizations?