Awesome guide. I have trying to start understanding Github and this guide will do the trick
Sent from my Galaxy Nexus using Tapatalk 2
Sent from my Galaxy Nexus using Tapatalk 2
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
rm -rf ./
git reset --hard
Tom,there's another way of force push,atleadt that's what I know..
git push -u origin +branchtopushto
I found it better to use "git reset --hard" if you want to reset the current git project completely, more often you might have extra files lurking around so in a dirty way you could do
Thanks for a refreshing course in gitCode:rm -rf ./ git reset --hard
Afaik, -u is only used to set the upstream/remote repository to push/pull from.
Thanks for your comments
If you feel that this guide deserve to be a sticky - report it
Can anyone help? I'm trying to cherry pick. I don't understand how or where to resolve the conflicts after merging upstream branch.
Thanks in advance
jsega@j:~$ ssh -vT git@github.com
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/jsega/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/jsega/.ssh/id_rsa-cert type -1
debug1: identity file /home/jsega/.ssh/id_dsa type -1
debug1: identity file /home/jsega/.ssh/id_dsa-cert type -1
debug1: identity file /home/jsega/.ssh/id_ecdsa type -1
debug1: identity file /home/jsega/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1+github8
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github8 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/jsega/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/jsega/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
Agent admitted failure to sign using the key.
debug1: Trying private key: /home/jsega/.ssh/id_dsa
debug1: Trying private key: /home/jsega/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).
ok ive done everything
Code:jsega@j:~$ ssh -vT git@github.com OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to github.com [207.97.227.239] port 22. debug1: Connection established. debug1: identity file /home/jsega/.ssh/id_rsa type 1 debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: identity file /home/jsega/.ssh/id_rsa-cert type -1 debug1: identity file /home/jsega/.ssh/id_dsa type -1 debug1: identity file /home/jsega/.ssh/id_dsa-cert type -1 debug1: identity file /home/jsega/.ssh/id_ecdsa type -1 debug1: identity file /home/jsega/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1+github8 debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github8 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /home/jsega/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/jsega/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 279 Agent admitted failure to sign using the key. debug1: Trying private key: /home/jsega/.ssh/id_dsa debug1: Trying private key: /home/jsega/.ssh/id_ecdsa debug1: No more authentication methods to try. Permission denied (publickey).
but im getting this!! any solution??
sudo apt-get install git
git config --global user.name "Your Name Here"
git config --global user.email "your_email@youremail.com"
ssh-keygen -t rsa -C "your_email@youremail.com"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
# Your identification has been saved in /c/Users/you/.ssh/id_rsa.
# Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@youremail.com
ssh -T git@github.com
The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
# Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
git clone git://github.com/eagleeyetom/android_packages_apps_Settings.git -b gingerbread
git branch xda
git checkout xda
git status
git add .
git add -u
git add name_of_file
git rm name_of_file
git commit -m 'my first commit'
git push
git push git@github.com:eagleeyetom/android_packages_apps_Settings.git xda
git branch deleteme
git checkout deleteme
git push git@github.com:eagleeyetom/android_packages_apps_Settings.git deleteme
git branch -a
remotes/origin/HEAD -> origin/gingerbread
remotes/origin/deleteme
remotes/origin/donut
remotes/origin/eclair
remotes/origin/froyo
remotes/origin/froyo-stable
remotes/origin/gb-release-7.2
remotes/origin/gingerbread
remotes/origin/gingerbread-release
remotes/origin/ics
remotes/origin/icsify
remotes/origin/wip
remotes/origin/xda
git branch -rd origin/deleteme
# Deleted remote branch origin/deleteme (was 808ffbb).
git push git@github.com:eagleeyetom/android_packages_apps_Settings.git :refs/heads/deleteme
git remote add upstream https://github.com/MiniCM/android_packages_apps_Settings.git
git fetch upstream
* [new branch] cm-9.0.0 -> upstream/cm-9.0.0
* [new branch] donut -> upstream/donut
* [new branch] eclair -> upstream/eclair
* [new branch] froyo -> upstream/froyo
* [new branch] froyo-stable -> upstream/froyo-stable
* [new branch] gb-release-7.2 -> upstream/gb-release-7.2
* [new branch] gingerbread -> upstream/gingerbread
* [new branch] gingerbread-release -> upstream/gingerbread-release
* [new branch] ics -> upstream/ics
* [new branch] jellybean -> upstream/jellybean
* [new branch] master -> upstream/master
* [new branch] wip -> upstream/wip
git add .
git commit -m 'test merge'
git push git@github.com:eagleeyetom/android_packages_apps_Settings.git xda
git remote add upstream https://github.com/MiniCM/android_packages_apps_Settings.git
git fetch upstream
git cherry-pick c95854e8c91ec279bd3719c637f531491855278a
git checkout -t remote_name/remote_branch
git checkout master
[COLOR="DeepSkyBlue"]# Check out your master branch[/COLOR]
git remote add TeamFun git://github.com/TeamFun/android_packages_apps_Settings.git
[COLOR="deepskyblue"]# Add a new remote named 'TeamFun'[/COLOR]
git fetch TeamFun
[COLOR="deepskyblue"]# Pull in all the commits from the 'cameronmcefee' remote[/COLOR]
git merge TeamFun/gingerbread
[COLOR="deepskyblue"]# Merge your master branch into the 'gingerbread' branch from the 'TeamFun' remote[/COLOR]
git push git@github.com:eagleeyetom/android_packages_apps_Settings.git master
[COLOR="deepskyblue"]# Push your newly-merged branch back to GitHub[/COLOR]
git checkout master
[COLOR="DeepSkyBlue"]# Check out your master branch[/COLOR]
$ curl http://github.com/octocat/Spoon-Knife/pull/25.patch | git am
[COLOR="deepskyblue"]# Grab the patch generated by a pull request and feed it into a new commit[/COLOR]
$ git push git@github.com:eagleeyetom/android_packages_apps_Settings.git master
[COLOR="deepskyblue"]# Push your newly-updated commit back to GitHub[/COLOR]
git checkout .
# to delete all changes
git checkout path/to/file
# to discard changes for a specific file
rm -rf ./
[COLOR="Cyan"]# deletes all of the files in the directory[/COLOR]
git reset --hard
[COLOR="cyan"]#This is going to restore the git to the previous state[/COLOR]
git reset HEAD --hard
git log --oneline #This would show the commit ID's
git show 22a95d1 > patchname.patch
git apply patchname.patch
# --check checks if the patch can be applied
git push -f git@github.com:eagleeyetom/android_packages_apps_Settings.git master
First of all, I'm new to this
I setup everything according to the tutorial.
Now I'm upstreaming sony 2011 stock kernel 2.6.32.9 on local repo and I want to sync changes to github repo.
Acording to "git status" command I've modified and deleted files.
should I use this command " git add . " then " git add -u"
or just "git add ." ??
Excuse me for being noob , Just want to make sure that I do the right thing.
Thanks in advance.