Some useful command lines

I prefer UI instead of CLI, so every time I need to type in the terminal I forget some command. These are some:

rm -rf mydir

delete an empty or non empty folder (-f : force, -r : recursive)

touch myfilename

create an empty file

cp /dev/null myfilename

empty the document content

wget -m -p -E -k -K -np http://yourdomain.com/subfolder/

grab all the files of current folder and sub-folder

find . -name .DS_Store -type f -delete

delete all .DS_Store (hidden OSX files) starting from “.” (the current directory)

git reset --hard

reset and set the workspace to pull fresh again

git pull

pulls everything from the repo

git config --global credential.helper cache

after that, git will never ask for your user/pass again. But if you have some problem, you can specify your data into repo/.git/config with this:

[user]
    name = you_name
    password = you_password
[credential]
    helper = store
git config --global user.email "you@example.com"
git config --global user.name "Your Name"

with that you can push with this info

git add <file>...

you stage the <file>

git add -A

you stage ALL files (also deleted files)

git commit -m "Add existing file"

you add a comment of the staged files

git push

you push (upload) all the files that staged

.gitignore does not ignore a folder

You are working in a repo (a GIT one) and you ignored a folder (in the -gitignore file) but still git is tracking this folder.

You can solve it with this 4 steps:

    1. Commit any changes that you need to fix/change.
    2. Run this command (which removes everything from the git index in order to refresh your git repository)

      git rm -r --cached .
    3. Then run this command (to add everything back to the repo)

      git add .
    4. Then, commit these changes using

      git commit -m ".gitignore Fixed"
    5. Finally, push it

      git push