Solved

Git push without pull?

Posted on 2014-04-04
2
2,592 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
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now