[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 @ WP or DEV

My Site villivald.com

GitHub github.com/villivald

Syed Fazle Rahman's photo

These are excellent notes! Thanks for sharing with us. 👏

MV's photo

Thank you!

Shamaayil Ahmed's photo

Much needed...