data science tutorials and snippets prepared by tomis9
Git is a totally basic program if you think seriously about programming. Seriously.
It’s a version control system, which makes:
working on the same project with many people simple;
remembers the whole history of the projects, i.e. all it’s chages as long as you follow git’s discipline
As you may have noticed, my posts usually contain a section called ‘A “Hello World” example’, but not this time. There are so many tutorials and books available on the Internet that I am sure you will find something suitable for yourself very quickly.
Knowing 6 git commands is a humorous description of a basic knowledge of git. But there is much truth in it: you only need 6 commands to work pretty efficiently with git. These are:
git add
git commit
git clone
git push/pull
git merge
git checkout
If you know all of them, you can update your LinkedIn profile with “knowledge of git”. If not, I recommend youtube tutorials, like this one:
In it’s consequences, git rebase
is equivalent to merge, but there are certain differences:
rebase changes the order of commits - in merge, they are chronological, in rebase - commits from branch 1 go first, then commits from branch 2;
in merge, you usually checkout to master and run git merge dev
, in rebase you checkout to dev and run git rebase master
;
DON’T REBASE PUBLIC BRANCHES, unless you want to die in the pain :)
In general, when you work on a specific project with your colleagues, I recommed using rebase, as chronological order is not that important. Thanks to rebase you can scroll the repo log and see the next functionalities (branches) appearing in order. If you even decide to give them special tags, boy, it really helps to kepp order!
Here are a few links which contain more information about rebasing: one, two.
Just replace the <name>
with your submodule’s name.
Once you do rebase and merge, before push your changes you may want to delete the merged branch first. You can do it with:
git revert (TODO)