git - 你的分支在1次提交之前超过'origin / master' [英] git - Your branch is ahead of 'origin/master' by 1 commit

查看:1436
本文介绍了git - 你的分支在1次提交之前超过'origin / master'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git的新手,我正在研究git。



我在git中添加了一些文件:

  git add<文件1> 
git add< file2>

然后我想推动它的审查,但错误地是我做了

  git commit 

如果我输入命令:

  git状态

它表示

 #分支大师
#你的分支在1次提交之前领先于'origin / master'。
$
没有提交(工作目录清理)

我想恢复那个提交,我想推送这些文件进行审查,而不是提交。
任何人都可以让我知道我可以怎么做吗?

解决方案

您无法推送任何尚未提交的内容然而。操作顺序是:
$ b $ ol

  • 进行更改。

  • git添加 - 这个阶段你的更改提交

  • git commit - 这会在本地提交您的阶段更改
  • li>
  • git push - 这将您提交的更改推送到远程

    如果你没有提交就推送,没有任何东西被推送。如果你没有添加提交,没有提交。如果你没有提交就添加,没有任何事情发生,git只是记得你添加的改变应该被考虑用于下面的提交。



    你看到的消息(你的换句话说: add commit 是本地操作, push pull fetch 是与远程交互的操作。

    由于似乎有官方来源控制你工作的地方的工作流程,你应该在内部询问应该如何处理。


    I am newbie in git and I am working on git.

    I added some files in git :

    git add <file1>
    git add <file2>
    

    then I wanted to push that for review, but mistakenly I did

    git commit
    

    so the files which I have changed don't go for reviews.
    Now if I enter the command :

    git status
    

    it says

    # On branch master
    # Your branch is ahead of 'origin/master' by 1 commit.
    #
    nothing to commit (working directory clean)
    

    I want to revert that commit and I want to push those files for review rather than commit. Can anyone let me know how I can do that?

    解决方案

    You cannot push anything that hasn't been committed yet. The order of operations is:

    1. Make your change.
    2. git add - this stages your changes for committing
    3. git commit - this commits your staged changes locally
    4. git push - this pushes your committed changes to a remote

    If you push without committing, nothing gets pushed. If you commit without adding, nothing gets committed. If you add without committing, nothing at all happens, git merely remembers that the changes you added should be considered for the following commit.

    The message you're seeing (your branch is ahead by 1 commit) means that your local repository has one commit that hasn't been pushed yet.

    In other words: add and commit are local operations, push, pull and fetch are operations that interact with a remote.

    Since there seems to be an official source control workflow in place where you work, you should ask internally how this should be handled.

    这篇关于git - 你的分支在1次提交之前超过'origin / master'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆