If you feel that you have fixed a problem and want to help the developer to make his own ROM/kernel etc. you should consider to make a pull request. Pull request adds the changes you have made to the others repo.
First of all.
Fork and clone destined repo.
Check the previous post about forking and cloning.
Now make some changes and upload it to your own remote git.
Then, go to your forked repo using browser and click on Pull request.
Then choose the account and branch to pull-request.
Click and wait for your request to be merged
Merging a pull request.
Sometimes someone wants to add something to your code.
You'll be notified by e-mail and also see the notification on your github website.
Go there and click Open
When the changes can't be merged you'll see such message:
But when it's green, you are ready to merge it
Don't forget to review the code. In other way you'll be forced to delete the commit.
You can also use text method:
git checkout master # Check out your master branch git remote add TeamFun git://github.com/TeamFun/android_packages_apps_Settings.git # Add a new remote named 'TeamFun' git fetch TeamFun # Pull in all the commits from the 'cameronmcefee' remote git merge TeamFun/gingerbread # Merge your master branch into the 'gingerbread' branch from the 'TeamFun' remote git push firstname.lastname@example.org:eagleeyetom/android_packages_apps_Settings.git master # Push your newly-merged branch back to GitHub
git checkout master # Check out your master branch $ curl http://github.com/octocat/Spoon-Knife/pull/25.patch | git am # Grab the patch generated by a pull request and feed it into a new commit $ git push email@example.com:eagleeyetom/android_packages_apps_Settings.git master # Push your newly-updated commit back to GitHub
To discard all unstaged changes e.g. failed merge etc. type:
git checkout . # to delete all changes git checkout path/to/file # to discard changes for a specific file
rm -rf ./ # deletes all of the files in the directory git reset --hard #This is going to restore the git to the previous state
To remove committed changes you have to revert the commit. But how to do that? It's your answer
git reset HEAD --hard
GIT PATCH AND GIT APPLY
Now I want to make a patch file to e.g. send an e-mail with my commited changes.
First I need to find a changes made by a commit. To do this I need to know commit ID.
git log --oneline #This would show the commit ID's
git show 22a95d1 > patchname.patch
The answer is easy. Use git apply.
git apply patchname.patch # --check checks if the patch can be applied
Sometimes github doesn't want to cooperate - just like some people
You can force it by adding --force or -f
git push -f firstname.lastname@example.org:eagleeyetom/android_packages_apps_Settings.git master
Clone the repo and delete everything but .git directory. Then copy modified content, commit and push :P
after copying public key to the git hub account and continuing it showing denied public key something like this