I'm here because : I try to connect my repository to another in order to keep "up to date" but I'm trying not to pull the whole history of the other repo...
To explain, I use Laravel 5 (https://github.com/laravel/laravel) and I have created my own master (which is a fork of laravel/v5.0.1) to customize some things inside (like a css framework, some generic layouts, etc.) -> call it "azurky-repo/master"
And now I feel like updating my repository with lastest commits of laravel/master but each time I pull from laravel/master, my "git log" is full of commits (about 4400) and I don't want this. (I'm a kind of maniac guy who wants a clean repository and a lot of control over everything ^^).
In an ideal world, I would like to update only the files and then just make one commit with a message like 'Update from Laravel/master'. Without any other extra history entry or refs that I don't need at all.
Tried without success :
git pull --depth 1 laravel master
I still have an extra history entry... (the last laravel/master commit message and didn't succeed in amending... maybe missed something)
Someone has an idea (or am I the only mad guy to try a thing like this..)?
P.S :
To clarify, I would like to have the same result as if I :
The matter is in fact I'm not masochist and don't want to bypass the merging ability of git... ^^
So I feel like having, finally, this history :
In place of :
Do you see what I hope ?
i.e. if you just want the latest commit use git clone --depth 1. branch is the name of the remote branch that you want to clone from. i.e. if you want the last 3 commits from master branch use git clone --depth 3 -b master. repo_url is the url of your repository.
Create a new orphan branch, named <new_branch>, started from <start_point> and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits.
Cloning an entire repo is standard operating procedure using Git. Each clone usually includes everything in a repository. That means when you clone, you get not only the files, but every revision of every file ever committed, plus the history of each commit.
The available list of formats can be retrieved with the git archive --list command. But the Git archive command includes only the files, not the history of those files.
Finally got it !
The answer is just a simple :
git reset HEAD
Sorry I'm really new to git so I found the solution this afternoon after reading questions about this kind of subjects. Didn't understood everything about indexes, now it's better =)
So from beginning I have a fresh repo with just an initial commit :
git clone git@mygitserver:myuser/myrepo
git log
commit 1
Initial commit - Laravel v5.0.1
Then I pull from laravel/master
git remote add laravel https://github.com/laravel/laravel.git
git pull laravel master
git reset HEAD
git add --all
git commit -m 'Update from laravel/master'
git log
commit 2
Update from laravel/master
commit 1
Initial commit - Laravel v5.0.1
That seems OK, then I make an other modif. to to be sure :
git rm -rf resources/assets/less/
git add --all
git commit -m 'Suppression de bootstrap'
git log
commit 3
Suppression de bootstrap
commit 2
Update from laravel/master
commit 1
Initial commit - Laravel v5.0.1
N.B : I write commit 1/2/3 to simplify of course
And then to be extra-sure :
git push origin master
And check on the repository web page
http://i.stack.imgur.com/7XMzb.jpg (sorry haven't the right to put the img)
That's OK for me =)
Finally I like the way git works =)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With