简体   繁体   中英

Local and remote git repositories issue

first I make a clone of a open source project I wish to work on from github to my local machine. i wish to make this copy local to my machine and to be a Master copy on my own machine. but it is currently development copy (devel) appears on the command line in git bash. I also have a github account with a clone of the master that I wish to work on. I want to be able to push to my own github clone from my local repository. then finally make a pull request to the master when submitting, but iam currenlty having trouble pushing from my local machine copy to my github account. I think the issue lies in the fact that i get this

/Desktop/myeclipse/proj (devel)

on the command line so I basically cant push to my github repository, which iam using between my local machine and the main repository of the project. Hope i phrased this question well enough. cheers!

The name that you see on your command line is the current branch -- it doesn't change where you'll be able to push code, it's just a state of the repository. "Master" is the default name for the "main" branch in git, but some projects choose other names. Check the project documentation for any information about the branching strategy that they employ.

To be able to push code to your GitHub fork and make pull requests, you'll want to add a remote to your clone. In git bash, within your clone:

git remote add mine <url from GitHub>

Do the work that you want to contribute in a new branch:

git checkout -b my-work

# Work work work
# Remember to commit often!
git add -p
git commit

Then push your work to the remote "mine" (the syntax here is git push where what ):

git push mine my-work

While you're working, if you want to merge in the latest version of the code from the original repository, make sure you have a clean working copy (no uncommitted changes or untracked files), then run:

git pull origin devel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM