Remove credentials from Git
2023-06-11
Question I'm working with several repositories, but lately I was just working in our internal one and all was great. Today I had to commit and push code into other one, but I'm having some troubles. $ git push appharbor master error: The requested URL returned error: 403 while accessing https://gavekortet@appharbor.com/mitivo.git/info/refs?service=git-receive-pack fatal: HTTP request failed There is nothing I can do, that would bring the password entry again. How can I reset the credentials on my system so Git will ask me for the password of that repository?…
How to change the commit author for a single commit?
2023-06-10
Question I want to change the author of one specific commit in the history. It's not the latest commit. Related: How do I change the author and committer name/email for multiple commits? Answer Interactive rebase off of a point earlier in the history than the commit you need to modify (git rebase -i <earliercommit>). In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify.…
How do I make Git ignore file mode (chmod) changes?
2023-06-09
Question I have a project in which I have to change the mode of files with chmod to 777 while developing, but which should not change in the main repo. Git picks up on chmod -R 777 . and marks all files as changed. Is there a way to make Git ignore mode changes that have been made to files? Answer Try: git config core.fileMode false From git-config(1): core.fileMode Tells Git if the executable bit of files in the working tree is to be honored.…
How do I resolve git saying "Commit your changes or stash them before you can merge"?
2023-06-09
Question I made some updates on my local machine, pushed them to a remote repository, and now I'm trying to pull the changes to the server and I get the message; error: Your local changes to the following files would be overwritten by merge: wp-content/w3tc-config/master.php Please, commit your changes or stash them before you can merge. So I ran, git checkout -- wp-content/w3tc-config/master.php and tried again and I get the same message.…
How do I safely merge a Git branch into master?
2023-06-08
Question A new branch from master is created, we call it test. There are several developers who either commit to master or create other branches and later merge into master. Let's say work on test is taking several days and you want to continuously keep test updated with commits inside master. I would do git pull origin master from test. Question 1: Is this the right approach? Other developers could have easily worked on same files as I have worked btw.…
What does git rev-parse do?
2023-06-08
Question What does git rev-parse do? I have read the man page but it raised more questions than answers. Things like: Pick out and massage parameters Massage? What does that mean? I'm using as a resolver (to SHA1) of revision specifiers, like git rev-parse HEAD^ or git rev-parse origin/master Is this the command’s purpose? If not, is even correct to use it to achieve this? Answer git rev-parse is an ancillary plumbing command primarily used for manipulation.…
What should be in my .gitignore for an Android Studio project?
2023-06-08
Question What files should be in my .gitignore for an Android Studio project? I've seen several examples that all include .iml but IntelliJ docs say that .iml must be included in your source control. Answer Updated to Android Studio 3.0 Please share missing items in comments. A late answer but this alternative answer was not right for us ... So, here's our gitignore file: #built application files *.apk *.ap_ *.aab files for the dex VM *.…