简体   繁体   中英

git master cannot merge branch

I'm new to git and I have created a branch (b1) from master

but the issue is, in the b1 branch has the codes I need and I need to merge those codes to master.but when i checkout to the master and try to merge the the b1 branch in to the master it says already updated.but that is not true. any suggestion

Make sure you are on master:

git branch 

=> * should be next to master

if not:

git checkout master

Check if everything in master is commited:

git status

If not everything is commited: - git add . - git commit -m 'added missing files' - optional: git push

Delete old branch to be clean:

git branch -d b1

Make a new branch:

git branch b1

Switch to new branch:

git checkout b1

Now everything should be as desired ;-)

The way you should work is this :

  1. git checkout -b 'yourBranch'
  2. make changes to your branch
  3. git add . (to add your changes)
  4. git commit -m "Your message on commit"
  5. git push origin 'yourBranch' (if there is a remote repo)
  6. git checkout master (to return on the master repo)
  7. git merge 'yourBranch'

Also, you can have a nice look here git-basic

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