How to use terminal commands with Github?

后端 未结 3 1537
难免孤独
难免孤独 2021-01-29 19:28

I have forked a private repository (an iPhone project) as follows:

cd nameofdirectory
git init
git clone forkedURL

Now I want to push the chang

相关标签:
3条回答
  • 2021-01-29 19:39

    You can't push into other people's repositories. This is because push permanently gets code into their repository, which is not cool.

    What you should do, is to ask them to pull from your repository. This is done in GitHub by going to the other repository and sending a "pull request".

    There is a very informative article on the GitHub's help itself: https://help.github.com/articles/using-pull-requests


    To interact with your own repository, you have the following commands. I suggest you start reading on Git a bit more for these instructions (lots of materials online).

    To add new files to the repository or add changed files to staged area:

    $ git add <files>
    

    To commit them:

    $ git commit
    

    To commit unstaged but changed files:

    $ git commit -a
    

    To push to a repository (say origin):

    $ git push origin
    

    To push only one of your branches (say master):

    $ git push origin master
    

    To fetch the contents of another repository (say origin):

    $ git fetch origin
    

    To fetch only one of the branches (say master):

    $ git fetch origin master
    

    To merge a branch with the current branch (say other_branch):

    $ git merge other_branch
    

    Note that origin/master is the name of the branch you fetched in the previous step from origin. Therefore, updating your master branch from origin is done by:

    $ git fetch origin master
    $ git merge origin/master
    

    You can read about all of these commands in their manual pages (either on your linux or online), or follow the GitHub helps:

    • https://help.github.com/articles/create-a-repo for commit and push
    • https://help.github.com/articles/fork-a-repo for fetch and merge
    0 讨论(0)
  • 2021-01-29 19:49
    git add myfile.h
    git commit -m "your commit message"
    git push -u origin master
    

    if you don't remember all the files you need to update, use

    git status
    
    0 讨论(0)
  • 2021-01-29 19:54

    To add all file at a time, use git add -A

    To check git whole status, use git log

    0 讨论(0)
提交回复
热议问题