Ignoring any 'bin' directory on a git project
2023-07-03
Question I have a directory structure like this: .git/ .gitignore main/ ... tools/ ... ... Inside main and tools, and any other directory, at any level, there can be a 'bin' directory, which I want to ignore (and I want to ignore everything under it too). I've tried each of these patterns in .gitignore but none of them work: /**/bin/**/* /./**/bin/**/* ./**/bin/**/* **/bin/**/* */bin/**/* bin/**/* /**/bin/* #and the others with just * at the end too Can anyone help me out?…
Should I check in folder "node_modules" to Git when creating a Node.js app on Heroku?
2023-07-03
Question I followed the basic getting started instructions for Node.js on Heroku here: https://devcenter.heroku.com/categories/nodejs These instruction don't tell you to create a .gitignore node_modules, and therefore imply that folder node_modules should be checked in to Git. When I included node_modules in Git repository, my getting started application ran correctly. When I followed the more advanced example at: Building a Real-time, Polyglot Application with Node.js, Ruby, MongoDB and Socket.IO https://github.com/mongolab/tractorpush-server (source) It instructed me to add folder node_modules to file .…
Squash the first two commits in Git? [duplicate]
2023-07-03
Question This question already has answers here: </div> Combine the first two commits of a Git repository? (9 answers) Closed 9 years ago. With git rebase --interactive <commit> you can squash any number of commits together into a single one. That's all great unless you want to squash commits into the initial commit. That seems impossible to do. Are there any ways to achieve it? Moderately related: In a related question, I managed to come up with a different approach to the need of squashing against the first commit, which is, well, to make it the second one.…
Convert list of dictionaries to a pandas DataFrame
2023-07-02
Question How can I convert a list of dictionaries into a DataFrame? Given: [{'points': 50, 'time': '5:00', 'year': 2010}, {'points': 25, 'time': '6:00', 'month': "february"}, {'points':90, 'time': '9:00', 'month': 'january'}, {'points_h1':20, 'month': 'june'}] I want to turn the above into a DataFrame: month points points_h1 time year 0 NaN 50 NaN 5:00 2010 1 february 25 NaN 6:00 NaN 2 january 90 NaN 9:00 NaN 3 june NaN 20 NaN NaN Note: Order of the columns does not matter.…
Git number of commits per author on all branches
2023-07-02
Question I'd like to get the number of commits per author on all branches. I see that git shortlog -s -n Prints a very nice list but it is not counting the commits that are not yet merged from other branches. If iterate this command over every branch then obviously the common commits get counted multiple times. Could you give me a script/command that would yield me the overall picture?…
How do you push a tag to a remote repository using Git?
2023-07-02
Question I added a tag to the master branch on my machine: git tag mytag master How do I push this to the remote repository? Running git push gives the message: Everything up-to-date However, the remote repository does not contain my tag. Answer To push a single tag: git push origin <tag_name> And the following command should push all tags (not recommended): # not recommended git push --tags
UnicodeDecodeError when reading CSV file in Pandas
2023-07-02
Question I'm running a program which is processing 30,000 similar files. A random number of them are stopping and producing this error... File "C:\Importer\src\dfman\importer.py", line 26, in import_chr data = pd.read_csv(filepath, names=fields) File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 400, in parser_f return _read(filepath_or_buffer, kwds) File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 205, in _read return parser.read() File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 608, in read ret = self._engine.read(nrows) File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 1028, in read data = self._reader.read(nrows) File "parser.pyx", line 706, in pandas.…