github skills?
bruce
badouglas at gmail.com
Sun Jan 28 17:29:07 UTC 2024
Hi Ian!!
thanks for the reply.
I'm walking through a couple of test sites..
my test use case will be taking a couple repos, and the dirs from
them, and creating a test repos with the folders combined with other
things..
from the site --
https://dev.to/art_ptushkin/how-to-migrate-a-directory-from-git-repository-to-another-one-preserving-git-history-bitbucket-example-15m5
--a dev site/url
--my goal is to see how to "extract/cp a folder" from the repo, and
insert in into another existing repos...
as I walk through the steps, i get to the line
-git remote add old-repo ../myrepo
with some questions... re the "old-repo" (close to the end of the
following steps)
overall steps are::
mkdir myrepo-folder2-migration
cd myrepo-folder2-migration
git clone
git at bitbucket.org:myproject/myrepo.git
cd myrepo
#prevent pushing into it
git remote rm origin
Filter git history to keep only files in folder2
git filter-branch --subdirectory-filter folder2 -- --all
Clean unwanted data
git reset --hard
git gc --aggressive
git prune
git clean -fd
It should contain only the files from folder2 in the root git directory now
Go back and prepare to work for the newrepo
cd ..
pwd
#make sure you're in myrepo-folder2-migration
Clone the empty repository
git clone git at bitbucket.org:newrepo.git
cd newrepo
Create a connection to local repository, we're going to pull from it
(exactly what does this step do!!!!!!!!)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(where/how whats the issue with the "old-repo"
if it's added.. where is it added??
is this somehow added to the "new" 2nd repo????
git remote add old-repo ../myrepo
Pull files from the old repo
git pull old-repo master --allow-unrelated-histories
Remove the connection with local
git remote remove old-repo
Push the changes to the remote origin
git push
The new remote repository should contain files from folder2 inside the
root directory now.
On Sun, Jan 28, 2024 at 11:08 AM Ian Bruntlett <ian.bruntlett at gmail.com> wrote:
>
> Hi Bruce,
>
> On Sun, 28 Jan 2024 at 15:43, bruce <badouglas at gmail.com> wrote:
>>
>> Perhaps a bit off topic. Getting familiar with github/git/gh. Setting
>> up a test scenario, walking through the different cmds, etc.
>>
>> Wondering if anyone in/on the list has github skills and a few mins to
>> play to play email/github guru/mentor!
>>
>> Hey, it's Sunday, maybe you're bored!
>
>
> I, too, am learning Git - via the O'Reilly book "Learning Git". I have some confidence with working with local repositories.
>
> Some pointers for you:
> * Install the git-doc package. Amongst other things it provides the user manual (which can also be found online: https://git-scm.com/docs/user-manual )
> * Install the gitk package. The gitk command provides a GUI to browse the local repository that it was started from.
> * Install the git-gui package. The git gui command provides a GUI for many aspects of Git.
> * The book Pro Git (2nd Edition) is available online: https://git-scm.com/book/en/v2 but I haven't read it yet.
>
> I have a shell script, greatly improved by help on the accu-general email mailing list which sets the command prompt to show information about the repository that I am in.
>
> Simply copy the script somewhere convenient for you and invoke it with the "." command. Something like
>
> . path/to/file/git-prompt.sh
>
> or the alternative
>
> source path/to/file/git-prompt.sh
>
> Here it is (you don't have to call it git-prompt.sh, you can call it anything you want):
>
> # Usage
> # . ~/git-prompt.sh
>
> # Initially borrowed from:
> # https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Bash
> # See also https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
>
> # unstaged (*) and staged (+) changes will be shown next to the branch
> # name. You can configure this per-repository with the
> # bash.showDirtyState variable, which defaults to true once
> # GIT_PS1_SHOWDIRTYSTATE is enabled.
> export GIT_PS1_SHOWDIRTYSTATE=1
>
> # You can also see if currently something is stashed, by setting
> # GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
> # then a '$' will be shown next to the branch name.
> export GIT_PS1_SHOWSTASHSTATE=1
>
> # If you would like a colored hint about the current dirty state, set
> # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
> # the colored output of "git status -sb" and are available only when
> # using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
> # but always available in Zsh.
> export GIT_PS1_SHOWCOLORHINTS=1
>
> # If you would like to see if there're untracked files, then you can set
> # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
> # files, then a '%' will be shown next to the branch name. You can
> # configure this per-repository with the bash.showUntrackedFiles
> # variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
> # enabled.
> export GIT_PS1_SHOWUNTRACKEDFILES=1
>
> # If you would like __git_ps1 to do nothing in the case when the current
> # directory is set up to be ignored by git, then set
> # GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
> # repository level by setting bash.hideIfPwdIgnored to "false".
>
> # Jonathan Wakely <accu at kayari.org> wrote:
> # I use my own custom bash prompt that works in huge Git repos.
> # The "official" git-prompt.sh is much too slow for the GCC repo (at least last
> # time I tried it). Mine caches the status between commands, and uses different
> # characters to show the branch status relative to upstream.
> # That's at https://gitlab.com/miscripts/miscripts/-/blob/master/profile.d/git-prompt.bash?ref_type=heads
>
> export PS1='\w$(__git_ps1 " (%s)")\$ '
>
>
> --
> -- ACCU - Professionalism in programming - http://www.accu.org
> -- My writing - https://sites.google.com/site/ianbruntlett/
> -- Free Software page - https://github.com/ian-bruntlett/TECH-Manuals/blob/main/tm-free-software.md
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
More information about the ubuntu-users
mailing list