Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Some wrong solutions to Git

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Note: the personal experience records of Git beginners are for reference only.

1. Pull is not possible because you have unmerged files.

Symptoms: during pull

$git pull

Pull is not possible because you have unmerged files.

Please, fix them up in the work tree, and then use 'git add/rm'

As appropriate to mark resolution, or use 'git commit-a'

I think it's because the local file conflicts.

Solution:

Quote--

"

1.pull will use git merge to cause conflicts. You need to resolve the conflicting file git add-u before git commit can successfully pull.

two。 If you want to discard local file changes, you can use git reset-- hard FETCH_HEAD,FETCH_HEAD to represent the commit point formed after the last successful git pull. Then git pull.

Note:

Git merge forms MERGE-HEAD (FETCH-HEAD). Git push forms a reference like HEAD. HEAD represents a local reference formed after a recent successful push.

"

In my experience, sometimes this happens inexplicably, and there are still a lot of Untracked files (in fact, I may only change one or two files), so I have to save the changes made by myself first, then use git reset-hard FETCH_HEAD to go back to the point after the last successful pull, and then pull will be no problem.

2.You are not currently on a branch.

Symptoms: once there was a conflict during pull, and this time the "git reset-hard FETCH_HEAD" method failed, and appeared:

$git pullYou are not currently on a branch, so I cannot use any'branch..merge' in your configuration file.Please specify which remote branch you want to use on the commandline and try again (e.g. 'git pull'). See git-pull (1) for details.

Solution:

First, git checkout-b temp

Secondly, git checkout master

You can return to the state of master repository, and then you can pull

Reference:

Http://skywhsq1987.iteye.com/blog/1814137

Http://slacy.com/blog/2011/04/git-pull-says-you-are-not-currently-on-a-branch/

Http://ddmytrenko.blogspot.com/2012/03/git-not-currently-on-any-branch.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report