I have forked a private repository (an iPhone project) as follows:
cd nameofdirectory git init git clone forkedURL
Now I want to push the changes done by me to my forked repository so that the main admin can review my written code and merge it with the main repository.
How can I push the changes done by me to my forked repository using terminal on MacOS?
Open Terminal. To launch GitHub Desktop to the last opened repository, type github . To launch GitHub Desktop for a particular repository, type github followed by the path to the repository. You can also change to your repository path and then type github . to open that repository.
To execute Git commands on your computer, you must open a terminal (also known as command prompt, command shell, and command line).
GitHub CLI brings GitHub to your terminal. Free and open source.
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:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With