Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Git push without pull?

Posted on 2014-04-04
2
Medium Priority
?
2,963 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 35

Accepted Solution

by:
Duncan Roe earned 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

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.…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

598 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