git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Basic Git usage

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Aug 14, 2010, 19:41 UTC
Message-ID
<AANLkTikQwwyos_xxD2Qvy-z7yjaoEYN-+twHPUKwKfNL@mail.gmail.com>
In-Reply-To
<1281760358285-5422412.post@n2.nabble.com>
On Sat, Aug 14, 2010 at 8:32 AM, hogsolo <greg@localdirt.com> wrote:
Show 7 quoted lines
>
> I have a master repo and have created a branch. I want to work in both at
> the same time. I want to change some files in the master, then switch to the
> branch ( git checkout branchname) , work on some files, then switch back to
> the master.
> However git wont let me switch back to the master until I have added,
> committed and pushed my files in the branch.
If you have modified files that are different between two branches then
Git won't allow to switch between them. You have two options:
- to commit your changes
- use "git stash"

In contrast to SVN and some other VCS, Git allows you to amend any commit later. To amend the last commit on the current branch, 'git commit --amend' can be used. If you want to modify arbitrary commits, (or squash, or delete some commits) take a look at: "git rebase --interactive"

Warning: modifying commits that you published (i.e. made available to
other users) is in general a bad idea, because it makes difficult for
other users to work with you.
Dmitry
Previous: Jakub Narebski
Message 3 of 3 in “Basic Git usage”
  1. hogsoloAug 14, 2010
  2. Jakub NarebskiAug 14, 2010
  3. Dmitry PotapovAug 14, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.