Thursday, January 21, 2021

[Git] How often do I commit and push?

I "commit" every time when I finish a single task. It can be anything small or big depending on the purpose of the task. It can mean a block of code to add, a few comments to add, deleting an outdated function, adding several new scripts, or changing the outputs. The rule of thumb is the "finished" task. You should be able to run the code without bugs. The frequency can be half an hour or 1-2 hours.

I have a final commit check and push every time when I close the project. Since I am working on the repo on my own right now, I usually push once or twice a day. 


Tuesday, January 19, 2021

[Python] Learning a new package pbr

https://pypi.org/project/pbr/

https://michaelkuty.com/howto/build-python-with-pbr/

https://dzone.com/articles/packaging-python-software-with-pbr

Wednesday, January 13, 2021

[Git] Study git and github in Pycharm

Set up git in Pycharm:

  • https://www.jetbrains.com/help/pycharm/set-up-a-git-repository.html#add-remote
Set up github in Pycharm:
  • There are two ways of set up. One is that you create a new repo on github and then git clone to the local file. The second way, which is more convenient, is to share your local project to Github.

Set up run/debug configuration:

  • https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html

Configure project structure in Pycharm:

  • https://www.jetbrains.com/help/pycharm/configuring-project-structure.html

Unversioned a file:

  • https://superuser.com/questions/898165/remove-file-from-git-version-control-without-deleting-it-from-the-filesystem

Manually delete file and then manage through git:

  • https://stackoverflow.com/questions/12987907/git-how-to-commit-a-manually-deleted-file
  • https://stackoverflow.com/questions/492558/removing-multiple-files-from-a-git-repo-that-have-already-been-deleted-from-disk
I just realized, after you rename a script, its previous history on github will get deleted. I still found the local log in Pycharm.

Change commit message after pushing to remote:
  • https://www.educative.io/edpresso/how-to-change-a-git-commit-message-after-a-push

Compare different files in Pycharm

  • Use compare with clipboard to compare current file (in editor) with the copied file
Compare different versions of the same file in Pycharm

  • In  "Show history", at the left navigation pane, right click on one commit, and select compare with local. Local will show up on the right.