search

Home  >  Q&A  >  body text

Git commit code steps

To submit code to coding.net for the first time, use the following three commands:

# git add .
# git commit -m"init project"
# git push

So, if you modify the code in the future, do you need to execute these 3 commands every time you submit it? Is there any difference?

怪我咯怪我咯2770 days ago1423

reply all(7)I'll reply

  • 为情所困

    为情所困2017-05-02 09:32:09

    git add -A commits all changes. You can use git status to view the current changes, and then selectively commit through git add xxx.
    git commit is to submit the changes locally first.
    git commit -m "xxxx" where the quotation marks are the description text of the submission.
    If you git commit directly, a vi interface will appear, in which you can enter the submission instructions. C-o saves, then C-x exits and commits.
    Push modifications to the remote end during git push

    Recommended https://book.douban.com/subject/24752672..., you can browse it generally.

    reply
    0
  • 怪我咯

    怪我咯2017-05-02 09:32:09

    After

    git add .是将当前版本库中所有修改提交到版本库暂存区中,当你commit, the temporary storage area will be cleared. Therefore, you still need to perform the add operation before submitting next time.
    I have also been learning GIT recently and wrote an introductory article. You can read it: http://justin-x.cn/2016/03/29/git-StudyN...

    reply
    0
  • PHPz

    PHPz2017-05-02 09:32:09

    It is recommended to search for the exact same question before asking in the future

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:32:09

    git commit -a -m"init project"
    git push

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:32:09

    sourcetree solves your problems! ! !

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:32:09

    The third item does not have to be executed, because the third item is pushed to the coding.net server. You can submit it locally first, and then push it to the server when necessary

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:32:09

    git clone -> workspace -> git add -> staging area -> git commit -> version library -> git push -> remote own warehouse -> pull request -> others Project warehouse

    reply
    0
  • Cancelreply