git分支和提交混乱

时间:2018-10-13 07:33:20

标签: git

我无法将我的提交合并到github中的master分支中。

这是我做过/尝试过的所有步骤

Import discord
Import time


@Client.command(pass_context=True)
async def ms_ping(ctx):
channel = ctx.message.channel   
try:
    t1 = time.perf_counter()
    await Client.send_typing(channel)
    ta = t1
    t2 = time.perf_counter()
    await Client.send_typing(channel)
    tb = t2
    ra = round((tb - ta) * 1000)
finally:
    pass
try:
    t1a = time.perf_counter()
    await Client.send_typing(channel)
    ta1 = t1a
    t2a = time.perf_counter()
    await Client.send_typing(channel)
    tb1 = t2a
    ra1 = round((tb1 - ta1) * 1000)
finally:
    pass
try:
    t1b = time.perf_counter()
    await Client.send_typing(channel)
    ta2 = t1b
    t2b = time.perf_counter()
    await Client.send_typing(channel)
    tb2 = t2b
    ra2 = round((tb2 - ta2) * 1000)
finally:
    pass
try:
    t1c = time.perf_counter()
    await Client.send_typing(channel)
    ta3 = t1c

    t2c = time.perf_counter()
    await Client.send_typing(channel)
    tb3 = t2c

    ra3 = round((tb3 - ta3) * 1000)
finally:
    pass
try:
    t1d = time.perf_counter()
    await Client.send_typing(channel)
    ta4 = t1d

    t2d = time.perf_counter()
    await Client.send_typing(channel)
    tb4 = t2d

    ra4 = round((tb4 - ta4) * 1000)
finally:
    pass

e = discord.Embed(title="Connection", colour = 909999)
e.add_field(name='Ping 1', value=str(ra))
e.add_field(name='Ping 2', value=str(ra2))
e.add_field(name='Ping 3', value=str(ra3))
e.add_field(name='Ping 4', value=str(ra4))
await Client.say(embed=e)

现在,我看不到我的上一份工作,我认为这是因为我做了“ git checkout master”和“ git checkout splashscreen”。

我可以通过返回到提交git push origin master Everything up-to-date Anils-MacBook-Pro:React-native-crypto anilbhatia$ git add . Anils-MacBook-Pro:React-native-crypto anilbhatia$ git commit -m "Final Production working build" [detached HEAD 46a7f55] Final Production working build 28 files changed, 87 insertions(+), 29 deletions(-) g rewrite android/app/src/main/res/mipmap-hdpi/ic_launcher.png (97%) rewrite android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png (98%) rewrite android/app/src/main/res/mipmap-hdpi/icon.png (99%) rewrite android/app/src/main/res/mipmap-mdpi/ic_launcher.png (99%) rewrite android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png (99%) rewrite android/app/src/main/res/mipmap-mdpi/icon.png (98%) rewrite android/app/src/main/res/mipmap-xhdpi/ic_launcher.png (99%) rewrite android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png (98%) rewrite android/app/src/main/res/mipmap-xhdpi/icon.png (98%) rewrite android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (98%) rewrite android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png (98%) rewrite android/app/src/main/res/mipmap-xxhdpi/icon.png (98%) rewrite android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (97%) rewrite android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png (99%) rewrite android/app/src/main/res/mipmap-xxxhdpi/icon.png (98%) delete mode 100644 src/images/123.png delete mode 100644 src/images/angel.jpg delete mode 100644 src/images/facebook.png delete mode 100644 src/images/instagram.png delete mode 100644 src/images/twitter.jpg Anils-MacBook-Pro:React-native-crypto anilbhatia$ git push fatal: You are not currently on a branch. To push the history leading to the current (detached HEAD) state now, use git push origin HEAD:<name-of-remote-branch> Anils-MacBook-Pro:React-native-crypto anilbhatia$ Anils-MacBook-Pro:React-native-crypto anilbhatia$ git checkout master Warning: you are leaving 2 commits behind, not connected to any of your branches: 46a7f55 Final Production working build 3af30c2 Victory Native graphs work If you want to keep them by creating a new branch, this may be a good time to do so with: git branch <new-branch-name> 46a7f55 Switched to branch 'master' Your branch is up to date with 'origin/master'. Anils-MacBook-Pro:React-native-crypto anilbhatia$ git push Everything up-to-date Anils-MacBook-Pro:React-native-crypto anilbhatia$ git checkout splashscreen Branch 'splashscreen' set up to track remote branch 'splashscreen' from 'origin'. Switched to a new branch 'splashscreen' Anils-MacBook-Pro:React-native-crypto anilbhatia$ git push Everything up-to-date Anils-MacBook-Pro:React-native-crypto anilbhatia$ git status . On branch splashscreen Your branch is up to date with 'origin/splashscreen'. nothing to commit, working tree clean Anils-MacBook-Pro:React-native-crypto anilbhatia$ git add . Anils-MacBook-Pro:React-native-crypto anilbhatia$ git commit -m "production build" On branch splashscreen Your branch is up to date with 'origin/splashscreen'. nothing to commit, working tree clean Anils-MacBook-Pro:React-native-crypto anilbhatia$ 来解决此问题,但是如何才能推送到我的github?

2 个答案:

答案 0 :(得分:1)

只需cherry-pick,就将46a7f55(以独立的HEAD模式在任何分支外部完成)提交给右分支:

git checkout master
git cherry-pick  46a7f55 
git push

答案 1 :(得分:1)

    To verify the current branch and status. Just do 
    git status

   Looks like you are not in branch

“您当前不在分支机构中。”

    git checkout splashscreen

     if you want to merge master changes to splash screen just do
     git merge master.

如果您希望将初始屏幕更改为母版,请结帐为母版        git checkout主        git merge启动画面。

  or else if you know the commit id, you could do
  git cherry-pick <commid-ID>
  git push