How does Git work?? ? To begin with, it's essential to identify where our code is stored. The common assumption is that there are only two locations - one on a remote server like Github and the other on our local machine. However, this isn't entirely accurate. Git maintains three local storages on our machine, which means that our code can be found in four places:? ? - Working directory: where we edit files? - Staging area: a temporary location where files are kept for the next commit? - Local repository: contains the code that has been committed? - Remote repository: the remote server that stores the code? ? Most Git commands primarily move files between these four locations.? ? Over to you: Do you know which storage location the "git tag" command operates on? This command can add annotations to a commit.? ? --? Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://bit.ly/3KCnWXq #systemdesign #coding #interviewtips? .
This is a solid breakdown of Git’s structure! One thing to keep in mind is understanding how changes flow through these stages, as it helps avoid conflicts and ensures smoother version control. Use git stash when you need to temporarily save your work without committing, especially when switching branches to avoid losing progress!
Wonderful visual representation!! Git pull, being a combination of git fetch and git merge, breaking the arrow of the git pull, at the local repo, would have shown that a copy is available at the local repo as well as in the working directory.
It is a bit more complicated in terms of merging/cherry-picking etc
Hi Alex Xu It would be great if you share some graphics about how Git controls Line Breaks (LF-CRLF) for different platforms (especially between Windows and Linux) Nowadays I have faced a problem related to this because of mounting local repo (Windows) to a container (Linux). But there isn’t enough visualized documentation about it. .gitattributes solved my issue but I still don’t understand the whole mechanism At which stage does Git change line breaks for text files? etc Some graphics would be very helpful
This is a great visual. But order is wrong. Should start from git clone and git checkout from the top. The rest ??
These concepts about #Git brought by Alex Xu are gold! " - Working directory: where we edit files - Staging area: a temporary location where files are kept for the next commit - Local repository: contains the code that has been committed - Remote repository: the remote server that stores the code Most Git commands primarily move files between these four locations. " Tks for sharing!
I won't be popular with this comment, but anything that's somewhat of a how to for Git always makes me think of that gamer pun. "Git gud" :)
Full Stack Developer (ReactJS/VueJS/NodeJS/Symfony)
1 个月I would say it depends. If the git tag command is used through a platform like GitHub, it operates on the remote repository, and you'll need to fetch the tags afterward to reflect them in the local repository. However, if it's used on a local machine, it operates on the local repository.