git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: mail.chris.az@gmail.com, git@vger.kernel.org
Subject: Re: Branch Management
Date: Wed, 11 Aug 2021 13:31:52 +0700	[thread overview]
Message-ID: <4b533ee7-4aa7-6ad5-6722-fca3eaadf464@gmail.com> (raw)
In-Reply-To: <01d001d78e36$8d47f380$a7d7da80$@gmail.com>

On 11/08/21 05.24, mail.chris.az@gmail.com wrote:
> I have a private git repository (private.git) on a private server
> (PRIVATEREPO.COM).  That repo is updated via development on my local system.
> All works great in that area.  I have 2 branches, "master" and "version".
> 
> I want to update my production system via git from the private git
> repository via command line.  The production system not only contains the
> files from the repo, but also additional files and directories.  I need
> those files to be left alone.
> 

You can specify which files and directories you want to ignore in 
.gitignore. For example, based on your use case:

```
/var/prod/
/etc/ohmyapp/ohmyapp.conf
...
```

> I was able to successful clone just the "master" branch using:
> 
> # git clone -b master git_user@PRIVATEREPO.COM:private.git production.git
> 
> I am now ready to move the new "version" branch.
> 1.  How can I do that?
> 

Use `git checkout version`.

> The "version" branch contains some new files that are not in the "master"
> branch.
> 
> Now suppose that I move to the "version" branch, but determine that I need
> to go back to the "master" branch.
> 
> 2.  How do I go back to the "master" branch and remove any of the new files
> that were uploaded from the "version" branch?  I don't want any remnants
> that the "version" branch was even there.
> 

Practically speaking, `git checkout` updates working directory to 
revision specified in the argument, ignoring `.gitignore`.

I assumed that you have app+default config committed to your repo (not 
including /var-like production data of course). In that case, a simple 
`git checkout` will do most of the job; you need to figure out how to 
handle .gitignore-ed trees (since these maybe version-specific).

-- 
An old man doll... just what I always wanted! - Clara

  reply	other threads:[~2021-08-11  6:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10 22:24 Branch Management mail.chris.az
2021-08-11  6:31 ` Bagas Sanjaya [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-06-09  6:26 [PATCH] show-branch: fix segfault when showbranch.default exists Junio C Hamano
2009-06-09  7:17 ` Stephen Boyd
2009-06-09  8:06   ` Pierre Habouzit
2009-06-09 16:28     ` Junio C Hamano
2009-06-09 17:23       ` Pierre Habouzit
2009-06-09 17:35         ` branch management Harry Duin
2009-06-09 19:50           ` Alex Riesen
2009-06-10 14:02             ` Harry Duin
2009-06-10 14:43               ` Jakub Narebski
2009-06-10 15:28                 ` Nicolas Pitre
2009-06-10 17:37                   ` Linus Torvalds
2009-06-10 19:14               ` Daniel Barkalow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b533ee7-4aa7-6ad5-6722-fca3eaadf464@gmail.com \
    --to=bagasdotme@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mail.chris.az@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).