Hi Katolaz,
On 12/19/2015 10:52 AM, KatolaZ wrote:
> On Sat, Dec 19, 2015 at 08:09:39AM +0100, Edward Bartolo wrote:
>> >Hi All,
>> >
>> >Finally, I fully restored my local netman sources from a full system
>> >backup I made on the 8th December 2015. Updating was a matter of only
>> >deleting the netman/debian directory and using "git pull".
>> >
>> >My goal was always to use the least invasive of methods to recover my
>> >sources. This was why I was very cautious about using any git command
>> >that would impact the uploaded sources.
>> >
>> >This experience is shouting at me to always keep a backup whenever I git push.
>> >
> Please allow me tpo disagree with your statement. This experience is
> shouting at you to always read the documentation of a software before
> using it. There is no need at all to make a backup whenever you git
> push something, and your fear about git pull is just due to not being
> confident enough in using git, or not having understood well how git
> works. There is no shame in "not knowing" or "not underdtanding". Both
> are just normal states, very common in all human beings, and can be
> cured by studying.
>
> There are ways in git to recover from almost any damage you can ever
> think of making to your repository, without the need to make a backup
> before every single pull. The "magic" recipes are in the git manual,
> and some bits of that knowledge have been gently offered to you in
> this ML. Books are made to be read, suggestions to be pondered, tips
> to be tried.
>
> HND
>
> KatolaZ
I agree, but tags are usefull.
Here you are an example with linux-libre:
$ git clone
https://gitlab.com/aitor_cz/linux-libre.git
Cloning into 'linux-libre'...
remote: Counting objects: 51541, done.
remote: Compressing objects: 100% (46325/46325), done.
remote: Total 51541 (delta 4325), reused 51541 (delta 4325)
Receiving objects: 100% (51541/51541), 145.84 MiB | 2.46 MiB/s, done.
Resolving deltas: 100% (4325/4325), done.
Checking connectivity... done.
Checking out files: 100% (47305/47305), done.
$ cd linux-libre
$ git checkout gbp-master/3.16.7-gnu-6
Note: checking out 'gbp-master/3.16.7-gnu-6'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at c17308d... modified: debian/changelog
$ ls
arch CREDITS Documentation fs ipc kernel Makefile
README scripts tools
block crypto drivers include Kbuild lib mm
REPORTING-BUGS security usr
COPYING debian firmware init Kconfig MAINTAINERS net
samples sound virt
$ git status
HEAD detached at gbp-master/3.16.7-gnu-6
nothing to commit, working directory clean
We have a *detached* HEAD, and we can't work in this stage. Let's give a
name to the branch:
$ git checkout -b the_name_of_the_branch
$ git status
On branch the_name_of_the_branch
nothing to commit, working directory clean
HTH,
Aitor.