git ignore vim temporary files
2022-09-28
Question What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)? Answer Vim temporary files end with ~ so you can add to the file .gitignore the line *~ Vim also creates swap files that have the swp and swo extensions. to remove those use the lines: *.swp *.swo This will ignore all the vim temporary files in a single project…
Python not working in the command line of git bash
2022-09-28
Question Python will not run in git bash (Windows). When I type python in the command line, it takes me to a blank line without saying that it has entered python 2.7.10 like its does in Powershell. It doesn't give me an error message, but python just doesn't run. I have already made sure the environmental variables in PATH included c:\python27. What else can I check? A session wherein this issue occurs looks like the following:…
Add only non-whitespace changes
2022-09-27
Question I have my text editor to automatically trim trailing whitespace upon saving a file, and I am contributing to an open source project that has severe problems with trailing whitespace. Every time I try to submit a patch I must first ignore all whitespace-only changes by hand, to choose only the relevant information. Not only that, but when I run git rebase I usually run into several problems because of them.…
Get commit list between tags in git
2022-09-27
Question If I've a git repository with tags representing the versions of the releases. How can I get the list of the commits between two tags (with a pretty format if is possible) ? Answer git log --pretty=oneline tagA...tagB (i.e. three dots) If you just wanted commits reachable from tagB but not tagA: git log --pretty=oneline tagA..tagB (i.e. two dots) or git log --pretty=oneline ^tagA tagB
Git remote branch deleted, but still it appears in 'branch -a'
2022-09-27
Question Let's say I had a branch named coolbranch in my repository. Now, I decided to delete it (both remotely and locally) with: git push origin :coolbranch git branch -D coolbranch Great! Now the branch is really deleted. But when I run git branch -a I still get: remotes/origin/coolbranch Something to notice, is that when I clone a new repository, everything is fine and git branch -a doesn't show the branch.…
How to exit git log or git diff [duplicate]
2022-09-27
Question This question already has answers here: </div> How to exit a 'git status' list in a terminal? (16 answers) Closed 7 years ago. I'm trying to learn Git with the help of Git Immersion. There's one thing that frustrates me whenever I use git log or git diff: I can't figure out what to do next when I encounter this (END) word. I can't type any commands, and I end up closing the current Bash window and open another.…
Can I delete a git commit but keep the changes?
2022-09-25
Question In one of my development branches, I made some changes to my codebase. Before I was able to complete the features I was working on, I had to switch my current branch to master to demo some features. But just using a "git checkout master" preserved the changes I also made in my development branch, thus breaking some of the functionality in master. So what I did was commit the changes on my development branch with a commit message "…