DEV Community

Cover image for [0] Git - My top 8
MV
MV

Posted on

[0] Git - My top 8

At the moment I am especially interested in Git and have recently passed two courses devoted to this technology. One course was from the University of Tampere, which I’m going to include in my degree. And the other one is a course called Git In-depth from Frontend Masters.

Actually, both courses were quite impressive, and I have learned a lot about Git. So, there are several points I found out and which I found particularly important as my personal top-8:

1). A remote repository

Adding and deleting:

git add remote repo

git delete remote repo

2). Branches

With switching to a new branch and without it:

git branches

3). Stashing

There is a simple example of using stashes below. It is quite handy when you want to save some changes but do not want to commit it yet.

git stashing

4). Tags are not something I use a lot, but anyway I think they could be useful for some occasions.

git tags

You should use git push –tags (or git push tag_name) to push tags to a remote repository.

5). Git merge. Fast-forwarding by default vs no fast-forward.

git merge exercise3:

git merge

I got the difference between git merge some_branch and git merge –no-ff some_branch. It is becoming obvious when you use git log –graph.

git merge –no-ff exercise3:

git merge

6). Git log – Grep, filter, since

There are some more “advanced” git features, like grep, filter, and since:

git log

7). Git log – no-pager and oneline

git log

8). Git commit –amend

Amend is a very useful commit “editing” tool. Actually, it’s not exactly editing, but as we can see from the sha of commits – c8a341a vs dcbdc49, amend creates a new commit from the last one.

git amend

P.S.

Finally, I realized that git pull = git fetch + git merge. Amen.

Original post 05.06.20 @ create-react-app.com
Site https://proj.create-react-app.com/
GitHub https://github.com/villivald

Top comments (3)

Collapse
 
prince_t profile image
Prince Takyi

Thanks for these invaluable key notes.

Collapse
 
villivald profile image
MV

Thank you 🙂 I'll be glad if it really helps somehow

Collapse
 
prince_t profile image
Prince Takyi

Of course it will. Particularly for newbies like myself.