Check out my 9 tips for you to learn GIT:
Do you use "git checkout my-branch" to switch to a branch? Maybe it is time to start using "git switch my-branch". It is the same command, but the name is straight forward.
Do you know what dash means in "git checkout -"? It is an alias for "@{-1}". It represents the name of the previous current branch. That is why "git checkout -" checks out the previous branch. Magic!
Did you know what "--" (two dashes) mean in "git checkout" command? They make sure that when you provide a file name, it is not interpreted as a branch etc. For example in "git checkout -- file.txt" command that discards changes to a file (restores last version)
"git checkout" is the most important GIT command. It has many features. It is used to switch between branches, create a new one, or rollback changes to a file!
A branch is like a copy of your files, you can work separately on. The work done on a new branch does not affect the previous one.
Saving changes from a working directory to the local repository happens in two steps:
💬 Staging - Deciding what you want to save
💬 Committing - Is like hitting the "save" button
Point 7. Have you ever cried over a deleted file? GIT offers the command "git rm -r my-file". It will only work if you have saved your changes!
Point 8. GIT actions vocabulary:
☀️ Working directory - your current copy of files
☀️ Staging - changes from working directory you choose to save to the local branch
☀️ Committing - saving staged changes to the local branch
☀️ Pushing - updating remote branch with local branch changes
Point 9. A merge is a process of synchronizing different "copies" of your project. If you changed the same line of code in two branches, GIT will ask you what version is the proper one. This process is called a conflict resolution.
Thank you for reading. If you want more upvote the article and follow me.
Also, check out Summon The JSON: GIT deck that has 65 cards to learn GIT and is also a game: GIT Flashcards. It is free to click the link!
Top comments (0)