FORUMS
Remove All Ads from XDA

[Guide] How to use Github

7,660 posts
Thanks Meter: 15,558
 
By eagleeyetom, Developer Committee Lead / XDA Portal Team / Senior Moderator on 8th September 2012, 08:32 PM
Post Reply Email Thread
18th April 2016, 02:10 PM |#321  
mgs1994's Avatar
Member
Thanks Meter: 4
 
More
it showing permision denied public key .. what should i do ??]
Quote:
Originally Posted by eagleeyetom

Pull request

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:

Code:
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 git@github.com:eagleeyetom/android_packages_apps_Settings.git master
# Push your newly-merged branch back to GitHub
or

Code:
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 git@github.com:eagleeyetom/android_packages_apps_Settings.git master
# Push your newly-updated commit back to GitHub
TIPS AND TRICKS

REVERT CHANGES

To discard all unstaged changes e.g. failed merge etc. type:
Code:
git checkout .
# to delete all changes

git checkout path/to/file

# to discard changes for a specific file
You can also use:
Code:
rm -rf ./ 

# deletes all of the files in the directory

git reset --hard

#This is going to restore the git to the previous state
HOW TO REMOVE COMMITTED CHANGES?

To remove committed changes you have to revert the commit. But how to do that? It's your answer

Code:
git reset HEAD --hard
HEAD is the previous commit. To revert to previous state use HEAD~1, HEAD~2 etc. you can also use the code taken from git log.

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.
Code:
git log --oneline #This would show the commit ID's
Now pick the commit for example 22a95d1 and use git show to make a patch

Code:
git show 22a95d1 > patchname.patch
And I got patch, but how to apply it?
The answer is easy. Use git apply.

Code:
git apply patchname.patch
# --check checks if the patch can be applied
FORCE PUSH
Sometimes github doesn't want to cooperate - just like some people
You can force it by adding --force or -f
Code:
git push -f git@github.com:eagleeyetom/android_packages_apps_Settings.git master
n00b method to add changes after failed push.
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
 
 
14th October 2016, 08:37 AM |#322  
FSadino's Avatar
Forum Moderator
Flag Away!
Thanks Meter: 2,247
 
Donate to Me
More
Hello all,

I want to upgrade my custom cm13 to cm14 and I have to merge frameworks/base but keep all commits from cm13. How can I do that? What I have to do to make a new repo with all cm14 changes plus cm13 commits?
Thanks in advance
Post Reply Subscribe to Thread

Tags
git, github, guide, pull request

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes