Thursday, October 17, 2013

GIT : Basic Command

1. How to color the Git console in Ubuntu?

# git config --global color.ui auto

The color.ui is a meta configuration that includes all the various color.* configurations available with git commands. This is explained in-depth in git help config.

color.ui: This variable determines the default value for variables such as color.diff and color.grep that control the use of color per command family. Its scope will expand as more commands learn configuration to set a default for the --color option. Set it to always if you want all output not intended for machine consumption to use color, to true or auto if you want such output to use color when written to the terminal, or to false or never if you prefer git commands not to use color unless enabled explicitly with some other configuration or the --color option.

2. How to keep password in memory?
# git config --global credential.helper cache
which tells git to keep your password cached in memory for (by default) 15 mins
# git config --global credential.helper "cache --timeout=3600"
which tells git to keep your password cached in memory for 3600 seconds

3. Get diff in file
# git diff
will return the file differences

4. How to resolving file conflicting after Git Pull?
Step 1> Identify which files are in conflict (Git should tell you this)
Step 2> Open each file and examine the diffs; Git demarcates them. Hopefully it will be obvious which version of each block to keep. You may need to discuss it with fellow developers who committed the code.
Step 3> Once you've resolved the conflict in a file, then apply below command in console
# git add file-name
Step 4> Then commit the conflict
# git commit -m "Conflicts Resolved"

5. How to add new file on Git?
# git add
# git commit -m "new file added"

6. How to check the file status in your repository?
# git status

7. How to push you committed file on the remote server?
# git push origin master

8. How to get the Git Update from remote server?
# git pull origin master

9. How to increase Git performance?
# git gc
will give significant speed on your local repository.
Basically, git-gc : it is for cleanup unnecessary files and optimize the local repository.

10. How to get the Git Log?
# git log

11. How to get log on specific file?
# git log "file-name"
# git log test.txt

12. How to get file from Git of specific version?
# git show commit-no:file-name

# git show abcdefghijklmnop:test.txt

13. How to know file list from Git of specific version?
# git show commit-no --name-only

# git show 0ba1a6177178f77cd711bfe1db43fac80f70f3e2 --name-only

14. How to use GUI visualize for Git log?
Please install gitk tool in your OS
# sudo apt-get install gitk
It will install in your OS, after that you are able to view the git log in GUI, where everybody easy to identify the following:
  • Commit with the name, and respective committed files
  • file change in every commit
  • Text search in committed file
  • beautiful file comparison
  • file navigation  
 Run below command to run GUI interface:
# gitk

15. How to remove file/folder from GIT
if you want to remove file, then

# git rm file-name
if you want to remove folder, then
# git rm folder-name -r

# git commit -m "your message"
#git push origin master

16. How to change message after GIT commit
# git commit --amend -m "New commit message"

Tuesday, October 1, 2013

SVN Error - is Not a working copy


I got the issue in SVN while doing additions in the SVN repository.

I am getting error Like :

"SVN : 'dir1' is not a working copy.

After a long struggling, i got the solution,  use below command to solve the issue i.e.:

# mv dir1 dir1_
# svn cleanup
# svn revert dir1
reverted 'dir1'
# mv dir1_ dir
# svn add dir1

In that way, i am able to get the my problem solve.