File tree Expand file tree Collapse file tree 2 files changed +22
-17
lines changed
Expand file tree Collapse file tree 2 files changed +22
-17
lines changed Original file line number Diff line number Diff line change @@ -88,24 +88,27 @@ Here's a `bash` script that I wrote to automate my dotfile backup workflow. You
8888
8989` ` ` bash
9090# Usage: backup-dots [COMMIT MESSAGE]
91- function backup-dots() {
91+ backup-dots () {
9292 echo " Backing up..."
93+ crontab -l > ~ /.config/crontab
9394 (
94- shallow-backup -no_splash -dotfiles -separate_dotfiles_repo;
95- cd " $HOME /shallow-backup/dotfiles/" || exit
96- git add .
97-
98- # If no commit message is provided, open vim.
99- # Otherwise, commit with the provided message
100- commit_msg=" $1 "
101- if [ -z " $commit_msg " ] ; then
102- git commit --verbose
103- else
104- git commit -m " $commit_msg "
105- fi
106- git push
95+ shallow-backup -no_splash -dotfiles -separate_dotfiles_repo
96+ cd " $HOME /shallow-backup/dotfiles/" || exit
97+ hub stash
98+ hub pull
99+ hub stash pop
100+ hub add .
101+ commit_msg=" $1 "
102+ if [ -z " $commit_msg " ]
103+ then
104+ hub commit --verbose
105+ else
106+ hub commit -m " $commit_msg "
107+ fi
108+ hub push
107109 )
108110}
111+
109112` ` `
110113
111114# ## What can I back up?
Original file line number Diff line number Diff line change @@ -130,18 +130,20 @@ def destroy_backup_dir(backup_path):
130130def get_abs_path_subfiles (directory ):
131131 """
132132 Returns list of absolute paths of files and folders contained in a directory,
133- excluding the root .git directory and root .gitignore. .
133+ excluding the .git directory, .gitignore, img/ and README.md in the root dir .
134134 """
135135 file_paths = []
136136 for path , _ , files in os .walk (directory ):
137137 for name in files :
138138 joined = os .path .join (path , name )
139139 root_git_dir = os .path .join (directory , ".git" )
140140 root_gitignore = os .path .join (directory , ".gitignore" )
141- if root_git_dir not in joined and root_gitignore not in joined :
141+ img = os .path .join (directory , "img" )
142+ readme = os .path .join (directory , "readme.md" )
143+ if not any (root_git_dir , root_gitignore , img , readme ) in joined :
142144 file_paths .append (joined )
143145 else :
144- print ( f "Excluded: { joined } " )
146+ print_path_red ( "Excluded:" , joined )
145147 return file_paths
146148
147149
You can’t perform that action at this time.
0 commit comments