Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active September 15, 2018 11:29
Show Gist options
  • Save YumaInaura/3cd6c9708ac4a30d4cc004158c24d6bb to your computer and use it in GitHub Desktop.
Save YumaInaura/3cd6c9708ac4a30d4cc004158c24d6bb to your computer and use it in GitHub Desktop.
Git for beginners — The "Bad" way to backup git branch or whole directory data

Git for beginners — The "Bad" way to backup git branch or whole directory data

The Points

  • In that way you do not need complexed git reflog git rebase or other ways.
  • This is bad methods but maybe useful untill you get used to git.

Backup whole local repository data

Just copy your local git directory.

In that way you can recover git repository to backup anytime even if you deleted git directory.

COPY

image

AND PASTE

image

BACKUPED!

image

How to return to backup

Copy backup nameed directory to original named directory.

Or hit command if you want

$ cp -r /path/to/repository /path/to/backup-repository

Backup to remote

Create temporary branch and push it.

$ git branch some_branch_backup
$ git checkout some_branch_backup
$ git push origin some_branch_backup

Backup git branch

Example

$ git branch some_branch_backup

git branch command creates "like" a copy of current branch.

Return to backup

$ git checkout some_branch_backup

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment