git still shows files as modified after adding to .gitignore
2023-06-19
Question i'm adding this to .gitignore file .idea/* but anyway the status is: # modified: .gitignore # modified: .idea/.generators # modified: .idea/dovezu.iml # modified: .idea/misc.xml # modified: .idea/workspace.xml what am i doing wrong ? i even added .idea/* to the global ~/.gitignore_global but git status, anyway shows me: # modified: .gitignore # modified: .idea/.generators # modified: .idea/dovezu.iml # modified: .idea/misc.xml # modified: .idea/workspace.xml Answer Your .gitignore is working, but it still tracks the files because they were already in the index.…
Git, How to reset origin/master to a commit?
2023-06-19
Question I reset my local master to a commit by this command: git reset --hard e3f1e37 when I enter $ git status command, terminal says: # On branch master # Your branch is behind 'origin/master' by 7 commits, and can be fast-forwarded. (use “git pull” to update your local branch) nothing to commit, working directory clean Since I want to reset origin/header as well, I checkout to origin/master: $ git checkout origin/master Note: checking out 'origin/master'.…
How to determine the URL that a local Git repository was originally cloned from
2023-06-19
Question I pulled a project with several forks on GitHub, but forgot which fork it was. How do I determine which fork I pulled? Answer To obtain only the remote URL: git config --get remote.origin.url If you require full output, and you are on a network that can reach the remote repo where the origin resides: git remote show origin When using git clone (from GitHub, or any source repository for that matter) the default name for the source of the clone is "…
Git keeps prompting me for a password
2023-06-18
Question I've been using Git for a while now, but the constant requests for a password are starting to drive me up the wall. I'm using Mac OS X and GitHub, and I set up Git and my SSH keys as instructed by GitHub's Set Up Git page. I've also added the github SSH key to my Mac OS X keychain, as mentioned on GitHub's SSH key passphrases page. My public key is registered with Git.…
How to add a changed file to an older (not last) commit in Git
2023-06-16
Question I have changed several things over the last hour and committed them step by step, but I just realized I've forgot to add a changed file some commits ago. The Log looks like this: GIT TidyUpRequests u:1 d:0> git log commit fc6734b6351f6c36a587dba6dbd9d5efa30c09ce Author: David Klein <> Date: Tue Apr 27 09:43:55 2010 +0200 The Main program now tests both Webservices at once commit 8a2c6014c2b035e37aebd310a6393a1ecb39f463 Author: David Klein <> Date: Tue Apr 27 09:43:27 2010 +0200…
How to view file diff in git before commit
2023-06-16
Question This often happens to me: I'm working on a couple related changes at the same time over the course of a day or two, and when it's time to commit, I end up forgetting what changed in a specific file. (This is just a personal git repo, so I'm ok with having more than one update in a commit.) Is there any way to preview the changes between my local file, which is about to be checked in, and the last commit for that file?…
How can I delete the current Git branch?
2023-06-15
Question I have a branch called Test_Branch. When I try to delete it using the recommend method, I get the following error: Cannot delete branch 'Test_Branch' checked out at '[directory location]'. I get no other information besides that. I can blow away the remote branch easy but the local branch won't go away. Answer Switch to some other branch and delete Test_Branch, as follows: $ git checkout master $ git branch -d Test_Branch If above command gives you error - The branch 'Test_Branch' is not fully merged.…