Solved

Git push without pull?

Posted on 2014-04-04
2
2,715 Views
Last Modified: 2014-04-08
Working on server, that got a drive replaced with the .git folder being moved.

Now we have a new drive and a bunch of work down on various scripts and programs.

When we go to push the work to the git repository we get:

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/...'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

The work on the server is the most current and we want to keep it and make it master.

What is the easiest way to do this without losing the current scripts.
0
Comment
Question by:freshgrill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 total points
ID: 39979996
I would git clone the remote repository to another location. Then use diffdir (attached) to see whether perhaps there are changes on the remote that you would like to keep.
Assuming there are no such changes or you have merged them into your local tree and committed them there, trecpy (also attached) your local tree to another different location. In this location, do a git pull. mv .git from your local tree to a safe place. mv .git from the other different location to your local tree. git status, git diff and git commit -a in your local tree as required. Then you can do your git push
diffdir
trecpy
0
 

Author Closing Comment

by:freshgrill
ID: 39987399
Worked perfectly. Thanks
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the cha…
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question