# Jun 10, 2015 - Git reset a solution always

Is usefull remind this… with git you have always a solution.. I actually make a mistake working on contrib project, and need a urgency rollback of one of my remote branches, the problema was simple delete a commit, and I found this post on stackoverflow response so usefull then I think “dude” you have to share, enjoy if you hve a bad memory like me:

What if I need a delete a bad commit made it.The list of solution:

Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command.

When you commit are the last, then this command will

git reset --hard HEAD~1


The HEAD~1 means the commit before head.

Or, you could look at the output of git log, find the commit id of the commit you want to back up to, and then do this:

git reset --hard <sha1-commit-id>


If you already pushed it, you will need to do a force push to get rid of it…

git push origin HEAD --force


However, if others may have pulled it, then you would be better off starting a new branch. Because when they pull, it will just merge it into their work, and you will get it pushed back up again.

If you already pushed, it may be better to use git revert, to create a “mirror image” commit that will undo the changes. However, both commits will both be in the log.

FYI – git reset --hard HEAD is great if you want to get rid of WORK IN PROGRESS. It will reset you back to the most recent commit, and erase all the changes in your working tree and index.

Lastly, if you need to find a commit that you “deleted”, it is typically present in git reflog unless you have garbage collected your repository.

source : http://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git

# Jun 8, 2015 - Green Console on CodeAnywhere

Well I’m fanatic of my green terminal, and for now I use a lot codenaywhere.com. Is a web IDE online, and you can create devbox, like a vps. Everything works great but I miss my green console. and I use this simple line of jQuery to edit the font color. Is cool anyway =)

BTW: Great tool,

jQuery(".terminal-wrap .terminal").attr("style","color:#00FF00");


# Mar 3, 2015 - First post new blog with jekyll

Hello world !

At least… my first post playing with jekyll… Nice tool. Well I hope this web have more duration than my last blog LOL.

Whoami.. just another geek trying to conquer the world…just joke ! From Chile to the world, love my country.

Hope this post will usefull for someone…For a lot of need to practice my writting english and blogging always is a good chance for share, also hope to write in spanish my native language. If something is not clear or you don’t understand nothing I write please add a comment I’ll really gracefull to fix.

Enjoy

# Nov 8, 2014 - Authentication Agent

## Fix “Could not open a connection to your authentication agent.” when using ssh-add {.blog-post-title}

If you’re trying to add identities to the authentication agent using ssh-add you may get this error:

Could not open a connection to your authentication agent.


The reason as the error message suggests is, ssh-add don’t know how to talk with the authentication agent.

The problem can be solved by setting SSH_AUTH_SOCK environment variable.

If you run ssh-agent you should get some output like this:

SSH_AUTH_SOCK=/tmp/ssh-agVZL13989/agent.13989; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13990; export SSH_AGENT_PID;
echo Agent pid 13990;


now if you evaluate that command output in your shell, the variable will be set:

eval \$(ssh-agent)


# Aug 23, 2014 - 12 Useful df Commands to Check Disk Space in Linux

## 12 Useful “df” Commands to Check Disk Space in Linux

​1. Check File System Disk Space Usage

The “df” command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.

[root@tecmint ~]# df

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2     78361192  23185840  51130588  32% /
/dev/cciss/c0d0p5     24797380  22273432   1243972  95% /home
/dev/cciss/c0d0p3     29753588  25503792   2713984  91% /data
/dev/cciss/c0d0p1       295561     21531    258770   8% /boot
tmpfs                   257476         0    257476   0% /dev/shm


### 2. Display Information of all File System Disk Space Usage

The same as above, but it also displays information of dummy file systems along with all the file system disk usage and their memory utilization.

[root@tecmint ~]# df -a

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2     78361192  23186116  51130312  32% /
proc                         0         0         0   -  /proc
sysfs                        0         0         0   -  /sys
devpts                       0         0         0   -  /dev/pts
/dev/cciss/c0d0p5     24797380  22273432   1243972  95% /home
/dev/cciss/c0d0p3     29753588  25503792   2713984  91% /data
/dev/cciss/c0d0p1       295561     21531    258770   8% /boot
tmpfs                   257476         0    257476   0% /dev/shm
none                         0         0         0   -  /proc/sys/fs/binfmt_misc
sunrpc                       0         0         0   -  /var/lib/nfs/rpc_pipefs


### 3. Show Disk Space Usage in Human Readable Format

Have you noticed that above commands displays information in bytes, which is not readable yet all, because we are in a habit of reading the sizes in megabytes, gigabytes etc. as it makes very easy to understand and remember.

The df command provides an option to display sizes in Human Readable formats by using ‘-h’ (prints the results in human readable format (e.g., 1K 2M 3G)).

[root@tecmint ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2      75G   23G   49G  32% /
/dev/cciss/c0d0p5      24G   22G  1.2G  95% /home
/dev/cciss/c0d0p3      29G   25G  2.6G  91% /data
/dev/cciss/c0d0p1     289M   22M  253M   8% /boot
tmpfs                 252M     0  252M   0% /dev/shm


### 4. Display Information of /home File System

To see the information of only device /home file system in human readable format use the following command.

[root@tecmint ~]# df -hT /home

Filesystem      Type    Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p5   ext3     24G   22G  1.2G  95% /home


### 5. Display Information of File System in Bytes

To display all file system information and usage in 1024-byte blocks, use the option ‘-k‘ (e.g. –block-size=1K) as follows.

[root@tecmint ~]# df -k

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2     78361192  23187212  51129216  32% /
/dev/cciss/c0d0p5     24797380  22273432   1243972  95% /home
/dev/cciss/c0d0p3     29753588  25503792   2713984  91% /data
/dev/cciss/c0d0p1       295561     21531    258770   8% /boot
tmpfs                   257476         0    257476   0% /dev/shm


### 6. Display Information of File System in MB

To display information of all file system usage in MB (Mega Byte) use the option as ‘-m‘.

[root@tecmint ~]# df -m

Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2        76525     22644     49931  32% /
/dev/cciss/c0d0p5        24217     21752      1215  95% /home
/dev/cciss/c0d0p3        29057     24907      2651  91% /data
/dev/cciss/c0d0p1          289        22       253   8% /boot
tmpfs                      252         0       252   0% /dev/shm


### 7. Display Information of File System in GB

To display information of all file system statistics in GB (Gigabyte) use the option as ‘df -h‘.

[root@tecmint ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2      75G   23G   49G  32% /
/dev/cciss/c0d0p5      24G   22G  1.2G  95% /home
/dev/cciss/c0d0p3      29G   25G  2.6G  91% /data
/dev/cciss/c0d0p1     289M   22M  253M   8% /boot
tmpfs                 252M     0  252M   0% /dev/shm


### 8. Display File System Inodes

Using ‘-i‘ switch will display the information of number of used inodes and their percentage for the file system.

[root@tecmint ~]# df -i

Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/cciss/c0d0p2    20230848  133143 20097705    1% /
/dev/cciss/c0d0p5    6403712  798613 5605099   13% /home
/dev/cciss/c0d0p3    7685440 1388241 6297199   19% /data
/dev/cciss/c0d0p1      76304      40   76264    1% /boot
tmpfs                  64369       1   64368    1% /dev/shm


### 9. Display File System Type

If you notice all the above commands output, you will see there is no file system type mentioned in the results. To check the file system type of your system use the option ‘T‘. It will display file system type along with other information.

[root@tecmint ~]# df -T

Filesystem      Type   1K-blocks  Used      Available Use% Mounted on
/dev/cciss/c0d0p2   ext3    78361192  23188812  51127616  32%   /
/dev/cciss/c0d0p5   ext3    24797380  22273432  1243972   95%   /home
/dev/cciss/c0d0p3   ext3    29753588  25503792  2713984   91%   /data
/dev/cciss/c0d0p1   ext3    295561     21531    258770    8%    /boot
tmpfs           tmpfs   257476         0    257476    0%   /dev/shm


### 10. Include Certain File System Type

If you want to display certain file system type use the ‘-t‘ option. For example, the following command will only display ext3 file system.

[root@tecmint ~]# df -t ext3

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2     78361192  23190072  51126356  32% /
/dev/cciss/c0d0p5     24797380  22273432   1243972  95% /home
/dev/cciss/c0d0p3     29753588  25503792   2713984  91% /data
/dev/cciss/c0d0p1       295561     21531    258770   8% /boot


### 11. Exclude Certain File System Type

If you want to display file system type that doesn’t belongs to ext3 type use the option as ‘-x‘. For example, the following command will only display other file systems types other thanext3.

[root@tecmint ~]# df -x ext3

Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                   257476         0    257476   0% /dev/shm


### 12. Display Information of df Command.

Using ‘–help‘ switch will display a list of available option that are used with df command.

[root@tecmint ~]# df --help

Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
-a, --all             include dummy file systems
-B, --block-size=SIZE use SIZE-byte blocks
-h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si              likewise, but use powers of 1000 not 1024
-i, --inodes          list inode information instead of block usage
-k                    like --block-size=1K
-l, --local           limit listing to local file systems
--no-sync         do not invoke sync before getting usage info (default)
-P, --portability     use the POSIX output format
--sync            invoke sync before getting usage info
-t, --type=TYPE       limit listing to file systems of type TYPE
-T, --print-type      print file system type
-x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
-v                    (ignored)
--help     display this help and exit
--version  output version information and exit

SIZE may be (or may be an integer optionally followed by) one of following:
kB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

Report bugs to <bug-coreutils@gnu.org>.


Source: http://www.tecmint.com/how-to-check-disk-space-in-linux/

Enviado por jguzman el Sáb, 08/23/2014 - 05:19