How can I force my local copy (currently untracked) to push up to the repository online?


I recently got a new computer. I have tracked respositorys on my old computer and the same repositories in bit bucket. I always exclude the .git folders from my backups and file transfers for efficiency so now that I have transferred all my local files to the new computer they are untracked with no .git folder. I need to add them to source tree on the new computer and keep working on them.

Therefore I need to get these files (and any recent changes since the last commit and push on the old computer) to push up to the online repository. However no matter which way I do it I always get errors. If I try to pull first I get errors, if I push and merge I get errors. I DO NOT want to clone all my repositories down again as some of them are quite large and it takes forever and uses a lot of data.

Basically I need to force merge my local copy which has identical or almost identical files (untracked) with that online and start tracking my local copy again.

Can someone please tell me how to do this with source tree?

So far the only way I have been able to figure this out is to do a clone. Then copy in my latest files into that clone then push the changes. As I mentioned before this is unworkable as I have a lot of repositories and it takes too long and too much data to clone them all.



1 answer


So you seem to have been over-efficient with your backups by omitting your .git folders. Omitting your .git-folders makes your remaining folders unknown to git. I don't know any other way than re-cloning the repositories and manually merge your remaining folders into the cloned repositories sad (the merging process could be done much easier using a compare tool like for example Beyond Compare)

Probably you might have done some things a little better on migration from old to new computer:

  • Check in all files on your old computer
  • Push all repositories on your old computer
  • Clone all needed repositories to new computer

or by leaving your .git folders in your backup

Don't you have the full repositories (including ,git folders) on your old computer?



Thanks for your input. Cloning is simply too slow. I have to leave it all night and half the time it fails. Also it doesn't sho a % done or any feedback. This isn't just about my computer move. If I get a new employee to contribute I don't want them to have to clone as it takes too long. I want to be able to give them a copy of my local files without my .git folder and then they just pick up and start working on those and merge them into the repository online. How can this be done? Surely I just need to force a merge.

I don't see an other solution: having modified local files (in folders without git) you need to do a manual merge into a local repository - then the repository has to be pushed to your remote server. Seems you either have a slow connection to your remote server and/or have huge repositories. As you wrote about "efficiency" for reason to remove the .git files I assume it's the second reason (huge repositories) - if this is true you might read this: I personally would try to keep my local .git folders - removing them you generate a lot of (expensive) work overhead (as described above) in favour of (cheap) disk space (which can be reduced according the methods described in

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,228 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you