Renaming branches remotely in Git
2023-05-29
Question If there is a repository that I only have git:// access to (and would usually just push+pull), is there a way to rename branches in that repository in the same way that I would do locally with git branch -m? Answer You just have to create a new local branch with the desired name, push it to your remote, and then delete the old remote branch: $ git branch new-branch-name origin/old-branch-name $ git push origin --set-upstream new-branch-name $ git push origin :old-branch-name Then, to see the old branch name, each client of the repository would have to do:…
Deleting DataFrame row in Pandas based on column value
2023-05-28
Question I have the following DataFrame: daysago line_race rating rw wrating line_date 2007-03-31 62 11 56 1.000000 56.000000 2007-03-10 83 11 67 1.000000 67.000000 2007-02-10 111 9 66 1.000000 66.000000 2007-01-13 139 10 83 0.880678 73.096278 2006-12-23 160 10 88 0.793033 69.786942 2006-11-09 204 9 52 0.636655 33.106077 2006-10-22 222 8 66 0.581946 38.408408 2006-09-29 245 9 70 0.518825 36.317752 2006-09-16 258 11 68 0.486226 33.063381 2006-08-30 275 8 72 0.…
Git ignore file for Xcode projects
2023-05-28
Question Which files should I include in .gitignore when using Git in conjunction with Xcode? Answer I was previously using the top-voted answer, but it needs a bit of cleanup, so here it is redone for Xcode 4, with some improvements. I've researched every file in this list, but several of them do not exist in Apple's official Xcode documentation, so I had to go on Apple mailing lists. Apple continues to add undocumented files, potentially corrupting our live projects.…
How do I "git blame" a deleted line?
2023-05-27
Question git blame is great for modified and added lines, but how can I find when a line that existed in a specific previous commit was eventually deleted. I'm thinking bisect, but I was hoping for something handier. (Before you ask: in this case, I just did a git log -p and searched through for the code line and (a) some idiot had just deleted the vital line in the previous commit and (b) I was that idiot.…
In git, is there a simple way of introducing an unrelated branch to a repository?
2023-05-27
Question While helping a friend with a git problem today, I had to introduce a branch that needed to be totally separate from the master branch. The contents of this branch really had a different origin from what had been developed on the master branch, but they were going to be merged into the master branch at a later time. I remembered from reading John Wiegley's Git from the bottom up how branches are essentially a label to a commit that follows a certain convention and how a commit is tied to a tree of files and, optionally to parent commits.…
SSL certificate rejected trying to access GitHub over HTTPS behind firewall
2023-05-27
Question I'm stuck behind a firewall, so I have to use HTTPS to access my GitHub repository. I'm using Cygwin 1.7.7 on Windows XP. I've tried setting the remote to https://username@github.com/username/ExcelANT.git, but pushing prompts for a password, but it doesn't do anything once I've entered it. https://username:<password>github.com/username/ExcelANT.git and cloning the empty repository from scratch, but each time it gives me the same error: error: SSL certificate problem, verify that the CA cert is OK.…
GitLab remote: HTTP Basic: Access denied and fatal Authentication
2023-05-26
Question Unlike this post, I am on macOS. I have the password configured in GitLab. I also have an SSL key created after the project was made on GitLab. When I use an existing folder for a new project and follow the steps below, I am prompted to enter my GitLab username and password. Existing folder cd existing_folder git init git remote add origin https://gitlab.com/sobopla/Geronimod.git git add . git commit -m "…