I am working on a repo and I did some local commits and now I want to do git pull origin develop whithout any change .. what should I do please ?
            Asked
            
        
        
            Active
            
        
            Viewed 361 times
        
    1
            
            
         
    
    
        Melek Yilmaz
        
- 409
- 1
- 5
- 16
- 
                    This isn't clear - what do you mean by "without any change"? – Oliver Charlesworth May 28 '16 at 15:13
- 
                    without any change of code done in the local commits – Melek Yilmaz May 28 '16 at 15:23
- 
                    @Lara You are trying to pull develop from the origin. In which branch you are working ? – Saleh Ahmad Oyon May 28 '16 at 15:26
- 
                    I am on develop :) – Melek Yilmaz May 28 '16 at 15:31
- 
                    you need only `git fetch origin develop:develop`. `git pull` will merge FETCH_HEAD to your local branch. – ElpieKay May 28 '16 at 15:33
- 
                    `git fetch origin develop:develop` did not solve my problem , I stil have changes from commits – Melek Yilmaz May 28 '16 at 15:41
3 Answers
1
            
            
        You can do
git log
for check the commit history. There you will find your commits. Take the commit number which is before your local changes. Then do
git checkout -f {Commit Number}
Then you will be your initial state (before make any local changes). Then do
git pull origin develop
The develop branch will update then. And i think you will get your expected result.
 
    
    
        Saleh Ahmad Oyon
        
- 672
- 1
- 6
- 20
- 
                    @Lara If you face any problem on checkout then try "git checkout -f {Commit Number}" . I have updated the command. It should work. – Saleh Ahmad Oyon May 28 '16 at 18:53
0
            
            
        Try git pull --rebase, it will make a three way merge and make your commit be the new HEAD.
Please let me know whether this command helps.
 
    
    
        Elinx
        
- 1,196
- 12
- 20
- 
                    it gives me `You are not currently on a branch. Please specify which branch you want to rebase against. See git-pull(1) for details. git pull` it means that I should do ` git pull origin develop` but when I do it gives me the my expected result + some changes from the local commits 
0
            
            
        You are not currently on a branch. Please specify which branch you want to rebase against.
That means you are currently in a detached HEAD: check that with:
git branch -avv
If you think you should be in the develop branch, reset it to whare you are:
git checkout -B develop
Then you can try git push origin develop again.
 
    