简体   繁体   中英

Git pull after local commit

I am new to git. I have a few local commits but I want to pull the latest code from the repository and don't yet want to push mine. However git pull, creates unnecessary merges. What is the right way to do this ie update your local repository without losing the changes.

The tool you are looking for is git rebase , though you should look at the documentation about that before you start using it. It is also generally good practice to do development in a local branch to reduce the overhead of this sort of operation.

When you are comfortable, you can use git pull --rebase to use rebase rather than merge to resolve differences after the pull -- but, do read the docs first, because this can lose data or cause headaches if misused. It is a useful but dangerous tool.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM