Difference between revisions of "Git pull writable"

From SlackWiki
Jump to: navigation, search
(Created page with "Category:Tips <pre> #Bash function to make git clone writable (annoyingly, if you clone repository, some files are non-user-writable... which after compiling dangerously t...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
[[Category:Tips]]
 
[[Category:Tips]]
 
<pre>
 
<pre>
#Bash function to make git clone writable (annoyingly, if you clone repository, some files are non-user-writable... which after compiling dangerously tempts 'sudo rm -rf!')
+
#Bash function to make git clones writable (annoyingly, if you clone repository, some files are non-user-writable... which after compiling dangerously tempts 'sudo rm -rf!')
 
git()
 
git()
 
{
 
{
   if [[ $1=="clone" ]]; then
+
   if [ $1 = "clone" ]; then
 
     command git "$@" && find */.git -type f -perm ! -u=w -exec chmod u+w {} \;
 
     command git "$@" && find */.git -type f -perm ! -u=w -exec chmod u+w {} \;
 
   else
 
   else

Latest revision as of 11:09, 21 May 2020

#Bash function to make git clones writable (annoyingly, if you clone repository, some files are non-user-writable... which after compiling dangerously tempts 'sudo rm -rf!')
git()
{
  if [ $1 = "clone" ]; then
    command git "$@" && find */.git -type f -perm ! -u=w -exec chmod u+w {} \;
  else
    command git "$@";
  fi;
}