git

How can I diff against a revision of a single file using only the default Git GUI tools?

I want to view the history of a single file, and then compare a single revision from that history against the current version. On the command line, this is easy: Run: git log -- <filename> Locate the version you want to compare, Run: git diff <commitid> -- <filename> But how can this be done using only the default Git gui tools,...

git-diff in another directory

I'm currently writing a little zsh function that checks all of my git repositories to see if they're dirty or not and then prints out the ones that need a commit. Thus far, I've figured out that the quickest way to figure out a git repository's clean/dirty status is via git-diff and git-ls-files: if ! git diff --quiet || git ls-files -...

git undo alias with xargs

I have a git alias (git undo) that undoes everything in the working directory, including new files, changed files, and deleted files: !git reset --hard && git ls-files -d | xargs -0 git rm --ignore-unmatch && git clean -fq On OS X, this works great. On Linux, however, I run into the following issue: if no files have been deleted from...

Importing existing git repo into assembla

Hi, Currently I have an website on a .zip file containing also the .git directory and all the history. I want it to be imported into an Assembla git repository preserving the history of all previous changes. Is there an easy way of doing it? ...

Track someone's GitHub repo in a branch

I'm pretty new to Git, and like it a lot so far, but am not sure what do do here. I've forked a github project, and am currently in the process of porting it to another language. For reference, I've created a branch of the code as it was when I made the fork. My problem now is that the original project has been updated, and I can't figu...

Tracking a fragment of a file in two places with git

Hi, I have code such as void myfunc() { introduction(); while(condition()) { complex(); loop(); interior(); code(); } cleanup(); } which I wish to duplicate into two versions, viz: void myfuncA() { introduction(); minorchangeA(); while(condition()) { complex(); loop(); interior(); ...

How to restore files that were removed by git?

I am a git noob and git just deleted a bunch of important files. How do I get them back? I have a repo on my local machine. To get into git, I just right click my project folder and select "git bash here". This brings up the master where I do all my giting. So I had some changes to stage and I did: git add . This staged a bunch of c...

Is there a way to make Git mark a file as conflicted?

It's possible to commit files that contains conflict data. Is there a way to mark these files as conflicted again, so that running git mergetool will generate the necessary files and run the merge tool? ...

Git - tidying up a repo

Hi I have got my repo into a bit of a state and want to be able to work my way out of it The repo looks a bit like this (A1, B1, C1 etc are obviously commits) A1 ---- A2 ---- A3 ---- A4 ---- A5 ---- A6 ---- A7 ---- A8 / (from a remote repo) B1 ---- B2...

Setting up a git repository on a server

Hi I had posted this question on superuser but didn't get a helpful response. Thought I'd try here since the question does deal with some configurations and settings for using github. I have a central server with SSO installed. All my machines are connected through the lan to this server. I have also setup a remote git repository on th...

Does using msysgit lead to repository corruption?

While stumbling through the chromium code documentation, I came across this post: http://code.google.com/p/chromium/wiki/UsingGit#Windows If you are using msysgit, you are asking for trouble. Using both msysgit (including TortoiseGit) and cygwin's version of git is a path to lead to repository corruption so it's safer to s...

Using GitHub with another Bug-tracker?

I am involved in this project, Pinta, and we are currently using GitHub for our development. We all love Git and GitHub and want to keep using it. However, now the project is getting stable and involved, and it's time we started using a more capable bug tracking system than GitHub's simple issue tracker. We also want to start doing GetTe...

How does git-diff generate hunk descriptions?

(git version 1.6.5.7) When I run git diff the output has a nice scope hint after the line numbers for my Python scripts, e.g.: diff --git a/file.py b/file.py index 024f5bb..c3b5c56 100644 --- a/file.py +++ b/file.py @@ -14,6 +14,8 @@ TITF: Test Infrastructure Tags Format ... @@ -1507,13 +1533,16 @@ class Tags( object ): ... Note that...

Git: Add part of (changed) file to index *by line numbers*

Is there a git command to add differences within a range of line-numbers to the index? I want to be able to select lines in my editor and run a macro to add any changes in the selection to the index. ...

Best way to fork SVN project with Git

I have forked an SVN project using Git because I needed to add features that they didn't want. But at the same time, I wanted to be able to continue pulling in features or fixes that they added to the upstream version down into my fork (where they don't conflict). So, I have my Git project with the following branches: master - the br...

Subversion has --record-only for merges, how do I do the same in Git ?

I have a repo where 'master' is going in a certain direction, and a second branch 'foo' is going to be divergent for a couple of commits, then track all subsequent changes to 'master' after that. This is all by choice of course. In Subversion you could do a --record-only merge to mark things as "merge has happened" even though no actua...

How do you cancel an external git diff?

I've got vim setup as my external diff tool: [diff] external = git_diff_wrapper #!/bin/sh vimdiff "$2" "$5" Say I have 300 files that have been modified; via bash, I type "git diff". It launches 300 vimdiffs sequentially, how do I abort it? ...

Show number of changed lines per author in git

i want to see the number of removed/added line, grouped by author for a given branch in git history. there is git shortlog -s which shows me the number of commits per author. is there anything similar to get an overall diffstat? ...

Start a git commit message with a hashmark (#)

Git treats lines starting with # as comment lines when committing. this is very annoying when working with a ticket tracking system, and trying to write the ticket number at the beginning of the line, e.g. #123 salt hashed passwords git will simply remove the line from the commit message. is there any way to escape the hash? i tried \...

Is it possible to have all "git diff" commands use the "Python diff", in all git projects?

When including the line *.py diff=python in a local .gitattributes file, git diff produces nice labels for the different diff hunks of Python files (with the name of the function where the lines changes are, etc.). Is is possible to ask git to use this diff mode for all Python files across all git projects? I tried to set a global ~...