git

Recovering added file after doing git reset --hard HEAD^

I added a new file F1 and made changes to another file F2 but then did a "git reset --hard HEAD^" and I have lost all the changes to the files. Is there SOME way, I can get them back. Please help. Thanks in advance. ps: I did look at a related question here: http://stackoverflow.com/questions/5473/undoing-a-git-reset-hard-head1 but,...

git selective revert local changes from a file

In my git repo which is tracking a svn repo I have made a number of edits to a single file. Now I want to revert those changes(like svn revert), but only portions of the file. I want to be able to view the diffs on the file, discard(revert) the changes that I don't want and retain the changes I want. the git add -i command seems t...

git-svn: how to copy git commits from one SVN branch to another?

I've got a git-svn checkout of my entire repo (initialized in the standard git svn init -t tags -b branches -T trunk $repo_url fashion, then git svn fetched). I manually svn copy $repo_url/branches/branch1 $repo_url/branches/branch2. I then ran git svn fetch, git checkout -b local-branch2 branch2, made a few commits to branch2, dcommited...

What are some Simple/Good ways to eventually merge two directories of source?

I have a source directory that includes a mix of different languages and files. Probably 100+ total files. I want to 'fork' that code and create a completely different version of the source. At this point, I will have version-1 of the code and version-2 of the code. I will not make that much development on version-1. I want to chang...

GIT diff GUI.

Hi there, I have a rather large diff of 2 GIT branches and would like to open them in some sort of nice UI side by side. Something that shows me the diff's easily, and hopefully that I can merge differences one by one. git diff is rather hard to work with. ...

Migrating odd subversion layout to git with history

I have a subversion repo with an odd layout: trunk Project1 Project2 tags Project1-0.2.4 Project2-1.9.0 branches Project1-crazyidea I know, I know, this was stupid. I should have had a trunk, tags, and branches directory underneath each Project. However, is there anyway to convert this to git (for a particular project) with...

Git: trouble with setting up daemon, trouble with git clone

Hello, Setting up new git installations. On one Windows laptop, I'm running (under cygwin): git daemon --base-path=/cygdrive/c/work/proj/ My project's root is c:\work\proj\proj1. There is a c:\work\proj\proj1\.git directory. git-daemon-export-ok exists in c:\work\proj\proj1. (git-daemon-export-ok can be an empty file, yes?) On ...

Git: cannot merge from master branch "object - It is a submodule"

I'm having difficulty merging from my master branch to a separate branch I've been developing on in quite sometime. Doing a straight forward merge I get the following: shell$ git merge master fatal: cannot read object asd211f3a58febecd4e447szxs733079211c71b7sa '/my/sub/dir/foo~master': It is a submodule! I never setup the library 'f...

git hangs up unexpectedly (but the push works)

I'm encountering some strange behavior so I'm hoping someone can help shed some light on this. When I do a git push, it ends with a "fatal: The remote end hung up unexpectedly" but checking the git logs and the remote repo seems to indicate the push went through fine. Rerunning the git push returns "Everything is up to date". So a littl...

"Index file corrupt"

New git user. After "git init", I added and committed a few files. Made some changes, added and committed. Set up the git daemon (running under Cygwin on WinXP) and cloned the repository once. Now, I get this error with the cloned repository: $ git status error: bad index file sha1 signature fatal: index file corrupt Is there any wa...

Github doubt - sync repo

I've never used a code source control system and I'm starting with GitHub and it looks amazing! I read the guides and I think I can understand pretty well how it works, and I'm working with it already, but something is not clear to me: does GitHub automatically sync the changes in the original repo to my fork? I've forked a project and...

How to make vi redraw screen?

When I use git commit --amend It will enter into a vi window to let me input comments for commit, the problem is the vi windows will show some dirty characters from former shell background. So I wonder how can I let vi to reload or redraw the screen to make the screen normal. So far, I try reset terminal and Ctrl+L, it works, but I ...

Git Submodule to a subfolder

In svn you can link a repository to any folder in another svn repository. I'm wondering if there is a similar feature for git? Basically I want a git submodule inside my repository, but I want the submodule to be a pointer to a subfolder of another git repository, not the whole repository. Is this possible? ...

How can I generate the difference between 2 commits which ignore spaces

In my git log, I have 2 commits. How can I generate the difference - ignoring spaces - between them? $ git log commit e5640171f391fdf479fa14fab0da6628efed1fa6 Author: test <[email protected]> Date: Mon Jul 13 11:41:02 2009 -0700 Fix Bug 1. commit 0984e27b75f480da8b8c4ce2399bf877c557a78d Author: test <[email protected]> Date:...

Can I modify git-add's hunk size?

I have a file that I've been working on and then realized that I had a mistake in it a few lines above where I've been working. I quickly fixed the mistake and want to commit it before I commit the rest of my work. Great, this is where git add --patch comes in! Except, I'm being presented with only one hunk incorporating both changes. I...

Merging between forks in GitHub

I forked a GitHub repository. Then I pushed some changes to my fork. Then the original repository merged my changes and some others. Now, I want to merge those changes I'm missing. I tried a simple pull followed by push, but this yield my commits in duplicate. What's the best way to do it? ...

git: Retrieve a single file from a repository

What is the most efficient mechanism (in respect to data transferred and disk space used) to get the contents of a single file from a remote git repository? So far I've managed to come up with: git clone --no-checkout --depth 1 [email protected]:foo/bar.git && cd bar && git show HEAD:path/to/file.txt This still seems overkill. What abo...

Force git to overwrite local files on pull.

The scenario is following: my team member is modifying the templates for a website we are working on he is adding some images to the images directory (but forgets to add them under source control) he is sending later the images by mail to me i'm adding the images under the source control and push them to github together with other chan...

Git or Subversion for binary files

We need to store binary files (mostly MS Word documents, ranging from a couple of KB to a couple of MB in size) in a version control repository with over 100 "projects". Currently we use Visual Source Safe but there are some problems, the database is crashing sometimes and the access is slow. We are considering moving to Git or Subver...

To put the prefix ?<revision-number> to codes by Git/Svn

How can you put the prefix ?v=VersionNumber to each file at your repository efficiently by Git/Svn? I found out that SO uses the practise to give version numbers to each specific file in its repo. They use SVN. I would like to know how you can do the same by Git. A few examples. #1 <link rel="stylesheet" href="/content/all.css?v=39...