All Distros, Git

Git: two awesome quick commands

Find branches the commit is on

git branch --contains <commit #>

Sample output:

Screen Shot 2017-10-17 at 10.18.41 PM10-17-17
fetch_weather, implement_axios and master all have the commit # 3dea5b6

Ref.: https://stackoverflow.com/questions/2706797/finding-what-branch-a-git-commit-came-from

Show all branches with unmerged commits to <branch>

git branch -a --no-merged <branch>

Sample output:

Screen Shot 2017-10-17 at 10.22.39 PM10-17-17
remotes/origin/error_handler has not yet been merged into master

Ref.: https://stackoverflow.com/questions/3600728/git-list-all-unmerged-changes-in-git

Happy git work!

Cheers!

Advertisements
Python

Merge two dictionaries in Python (2.7)

Disclaimer:
This matter is extent. There are a number of different ways to do the same thing. My goal is to have an easy-to-do shortcut at hand to use it when I need it. See a link below for the source article with more information and discussion on the topic.

Dictionaries to be merged into a third one, z:

>>> x = {'a': 1, 'b': 2}
>>> y = {'b': 3, 'c': 4}

To merge them:

>>> z = x.copy()
>>> z.update(y)

which returns:

>>> z
{'a': 1, 'b': 3, 'c': 4}

Note that the value of 'b' was the last one updated, coming from the y dictionary.

For further details on this topic, please visit the source article at Stack Overflow.

Thanks!