git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git fetch,git merge and git rebase
@ 2011-02-10  5:29 Akash
  2011-02-10  7:22 ` Alexey Shumkin
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Akash @ 2011-02-10  5:29 UTC (permalink / raw)
  To: git


Hi,

I am new to git .Can someone explain in simple terms what git fetch,git
merge and git rebase do?..I tried googling but was very confused after going
thro it.

Also, can someone prescribe a link which explains git in detail right from
scratch.


-- 
View this message in context: http://git.661346.n2.nabble.com/git-fetch-git-merge-and-git-rebase-tp6010561p6010561.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10  5:29 git fetch,git merge and git rebase Akash
@ 2011-02-10  7:22 ` Alexey Shumkin
  2011-02-10  8:22   ` Jonathan Nieder
  2011-02-10  7:25 ` Alexey Shumkin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Alexey Shumkin @ 2011-02-10  7:22 UTC (permalink / raw)
  To: git

Akash <bcakashguru <at> gmail.com> writes:

> 
> 
> Hi,
> 
> I am new to git .Can someone explain in simple terms what git fetch,git
> merge and git rebase do?..I tried googling but was very confused after going
> thro it.
> 
> Also, can someone prescribe a link which explains git in detail right from
> scratch.
> 

RFTM, with all respect ))
http://progit.org/book/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10  5:29 git fetch,git merge and git rebase Akash
  2011-02-10  7:22 ` Alexey Shumkin
@ 2011-02-10  7:25 ` Alexey Shumkin
  2011-02-10 20:00 ` Neal Kreitzinger
  2011-02-10 22:21 ` Neal Kreitzinger
  3 siblings, 0 replies; 11+ messages in thread
From: Alexey Shumkin @ 2011-02-10  7:25 UTC (permalink / raw)
  To: git

> I am new to git .Can someone explain in simple terms what git fetch,git
> merge and git rebase do?..I tried googling but was very confused after going
> thro it.

and also https://git.wiki.kernel.org/index.php/GitFaq

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10  7:22 ` Alexey Shumkin
@ 2011-02-10  8:22   ` Jonathan Nieder
  2011-02-11  6:59     ` Akash
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2011-02-10  8:22 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: git, Akash

Alexey Shumkin wrote:
> Akash writes:

>> I am new to git .Can someone explain in simple terms what git fetch,git
>> merge and git rebase do?..I tried googling but was very confused after going
>> thro it.
>> 
>> Also, can someone prescribe a link which explains git in detail right from
>> scratch.
>
> RFTM, with all respect ))
> http://progit.org/book/

More hints:

 - "man git" (or "git help git") has some hints to get started:
   . a tutorial
   . a list of "everyday git" commands to get going
   . a short article on centralized, cvs-style workflow
   . a user's manual

 - when anything is unclear in those documents, I will be very happy
   to learn about it (so cc me in that case :)).  Please be specific
   as possible about what is confusing.

 - people on this mailing list and the #git channel on freenode are
   generally happy to help if you are trying to do something
   specific (or have some other specific question).

 - there's much material on the web in addition to what's mentioned
   above.  For example the old git crash course for svn users at
   http://git.or.cz/course/svn.html taught me a lot about both git and
   svn.  Theoretically, good material from a variety of sources can
   gradually flow into the user's manual and reference manual pages,
   though actual practice does not always match that theory.

Good luck.

Kind regards,
Jonathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10  5:29 git fetch,git merge and git rebase Akash
  2011-02-10  7:22 ` Alexey Shumkin
  2011-02-10  7:25 ` Alexey Shumkin
@ 2011-02-10 20:00 ` Neal Kreitzinger
  2011-02-10 22:21 ` Neal Kreitzinger
  3 siblings, 0 replies; 11+ messages in thread
From: Neal Kreitzinger @ 2011-02-10 20:00 UTC (permalink / raw)
  To: Akash; +Cc: git

On 2/9/2011 11:29 PM, Akash wrote:
>
> Hi,
>
> I am new to git .Can someone explain in simple terms what git fetch,git
> merge and git rebase do?..I tried googling but was very confused after going
> thro it.
>
> Also, can someone prescribe a link which explains git in detail right from
> scratch.
>
>
git fetch:  retrieve the latest version of a branch and store it in the 
/remotes/* "remote tracking branches" of your local repo.  you can view 
these branches with "git branch -a".  Once you have that local copy, you 
can merge it into other branches, checkout objects from it, and run 
diffs against it.  You are not supposed to EVER make commits on a 
remote/* branch.  its sole purpose in life is to maintain an image the 
the corresponding branchs that its tracking in the remote repo.  you 
update that image by performing git fetch.  see man-page for details.

git merge:  merges branch(s) into your current branch.  see man-page for 
details.  lots and lots of details...

git rebase:  takes all the local commits you've made on an old history 
and rewrites them on-top of the new history.  it makes it look like you 
did your work based on the new history instead of the old history.  it 
keeps your history 'linear' instead of having all these merge DAG's in 
your history like git-merge produces.  see man page for details.  lots 
and lots of details are not easy to understand at first...

hope this helps.

v/r,
neal

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10  5:29 git fetch,git merge and git rebase Akash
                   ` (2 preceding siblings ...)
  2011-02-10 20:00 ` Neal Kreitzinger
@ 2011-02-10 22:21 ` Neal Kreitzinger
  2011-02-10 23:03   ` Jeff King
  2011-02-11 12:32   ` Felipe Contreras
  3 siblings, 2 replies; 11+ messages in thread
From: Neal Kreitzinger @ 2011-02-10 22:21 UTC (permalink / raw)
  To: Akash; +Cc: git

On 2/9/2011 11:29 PM, Akash wrote:
>
> Hi,
>
> I am new to git .Can someone explain in simple terms what git fetch,git
> merge and git rebase do?..I tried googling but was very confused after going
> thro it.
>
> Also, can someone prescribe a link which explains git in detail right from
> scratch.
>
>
another definition of git-rebase:

git-rebase:  the MOST DANGEROUS command in git.  you can easily DESTROY 
your repo if you don't know what you're doing!  Until you get the hang 
of it, always make a copy of the before-image of the branch your 
rebasing (mybranch) by doing a "git checkout mybranch" and then "git 
branch copy-of-mybranch".  Then if you destroy mybranch you can recover 
it from copy-of-mybranch.

v/r,
neal

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10 22:21 ` Neal Kreitzinger
@ 2011-02-10 23:03   ` Jeff King
  2011-02-11  7:00     ` Akash
  2011-02-11 12:32   ` Felipe Contreras
  1 sibling, 1 reply; 11+ messages in thread
From: Jeff King @ 2011-02-10 23:03 UTC (permalink / raw)
  To: Neal Kreitzinger; +Cc: git

On Thu, Feb 10, 2011 at 04:21:27PM -0600, Neal Kreitzinger wrote:

> another definition of git-rebase:
> 
> git-rebase:  the MOST DANGEROUS command in git.  you can easily
> DESTROY your repo if you don't know what you're doing!  Until you get
> the hang of it, always make a copy of the before-image of the branch
> your rebasing (mybranch) by doing a "git checkout mybranch" and then
> "git branch copy-of-mybranch".  Then if you destroy mybranch you can
> recover it from copy-of-mybranch.

I won't claim that rebase isn't easy to shoot yourself in the foot with,
but I think this advice is a little over-the-top. Rather than backing up
branches, you would do better to learn about reflogs, as the reflog of
mybranch will contain the original version. As will the reflog of HEAD,
though if you have screwed up too badly, the reflog of mybranch will
probably be a lot simpler to read.

You can see it with "git reflog show mybranch"; when you see the commit
that you want to restore to, you can:

  git branch -f mybranch mybranch@{whatever}

to restore it there. That provides more-or-less the same safety as a
backup branch (reflogs do expire, but something like three months
later), plus it helps you in all the cases where you forgot to make a
backup before screwing things up. :)

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10  8:22   ` Jonathan Nieder
@ 2011-02-11  6:59     ` Akash
  0 siblings, 0 replies; 11+ messages in thread
From: Akash @ 2011-02-11  6:59 UTC (permalink / raw)
  To: git


Thanks Jonathan:)
-- 
View this message in context: http://git.661346.n2.nabble.com/git-fetch-git-merge-and-git-rebase-tp6010561p6014719.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10 23:03   ` Jeff King
@ 2011-02-11  7:00     ` Akash
  0 siblings, 0 replies; 11+ messages in thread
From: Akash @ 2011-02-11  7:00 UTC (permalink / raw)
  To: git


Thanks Neal:)
-- 
View this message in context: http://git.661346.n2.nabble.com/git-fetch-git-merge-and-git-rebase-tp6010561p6014723.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-10 22:21 ` Neal Kreitzinger
  2011-02-10 23:03   ` Jeff King
@ 2011-02-11 12:32   ` Felipe Contreras
  2011-02-11 17:13     ` Neal Kreitzinger
  1 sibling, 1 reply; 11+ messages in thread
From: Felipe Contreras @ 2011-02-11 12:32 UTC (permalink / raw)
  To: Neal Kreitzinger; +Cc: Akash, git

On Fri, Feb 11, 2011 at 12:21 AM, Neal Kreitzinger
<nkreitzinger@gmail.com> wrote:
> On 2/9/2011 11:29 PM, Akash wrote:
>>
>> Hi,
>>
>> I am new to git .Can someone explain in simple terms what git fetch,git
>> merge and git rebase do?..I tried googling but was very confused after
>> going
>> thro it.
>>
>> Also, can someone prescribe a link which explains git in detail right from
>> scratch.
>>
>>
> another definition of git-rebase:
>
> git-rebase:  the MOST DANGEROUS command in git.  you can easily DESTROY your
> repo if you don't know what you're doing!  Until you get the hang of it,
> always make a copy of the before-image of the branch your rebasing
> (mybranch) by doing a "git checkout mybranch" and then "git branch
> copy-of-mybranch".  Then if you destroy mybranch you can recover it from
> copy-of-mybranch.

What about 'git rebase --hard', or 'git branch -D'? In all cases you
can recover by using the reflog.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git fetch,git merge and git rebase
  2011-02-11 12:32   ` Felipe Contreras
@ 2011-02-11 17:13     ` Neal Kreitzinger
  0 siblings, 0 replies; 11+ messages in thread
From: Neal Kreitzinger @ 2011-02-11 17:13 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Akash, git

On 2/11/2011 6:32 AM, Felipe Contreras wrote:
> On Fri, Feb 11, 2011 at 12:21 AM, Neal Kreitzinger
> <nkreitzinger@gmail.com>  wrote:
>> On 2/9/2011 11:29 PM, Akash wrote:
>>> Hi,
>>>
>>> I am new to git .Can someone explain in simple terms what git fetch,git
>>> merge and git rebase do?..I tried googling but was very confused after
>>> going
>>> thro it.
>>>
>>> Also, can someone prescribe a link which explains git in detail right from
>>> scratch.
>>>
>>>
>> another definition of git-rebase:
>>
>> git-rebase:  the MOST DANGEROUS command in git.  you can easily DESTROY your
>> repo if you don't know what you're doing!  Until you get the hang of it,
>> always make a copy of the before-image of the branch your rebasing
>> (mybranch) by doing a "git checkout mybranch" and then "git branch
>> copy-of-mybranch".  Then if you destroy mybranch you can recover it from
>> copy-of-mybranch.
> What about 'git rebase --hard', or 'git branch -D'? In all cases you
> can recover by using the reflog.
>
i take you meant 'git reset --hard'...

v/r,
neal

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-02-11 17:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10  5:29 git fetch,git merge and git rebase Akash
2011-02-10  7:22 ` Alexey Shumkin
2011-02-10  8:22   ` Jonathan Nieder
2011-02-11  6:59     ` Akash
2011-02-10  7:25 ` Alexey Shumkin
2011-02-10 20:00 ` Neal Kreitzinger
2011-02-10 22:21 ` Neal Kreitzinger
2011-02-10 23:03   ` Jeff King
2011-02-11  7:00     ` Akash
2011-02-11 12:32   ` Felipe Contreras
2011-02-11 17:13     ` Neal Kreitzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).