Skip to main content

how to setup git in windows machine



how to setup git in windows machine
#install github for windows - https://git-for-windows.github.io/
#create folder
#select folder right click and git bash here
in cmd line use
or create a new repository on the command line

echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/spectrumted/test.git
git push -u origin master

…or push an existing repository from the command line

git remote add origin https://github.com/spectrumted/test.git
git push -u origin master

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
to add git on webserver
download putty
give cpanel domain as host port 22 then ok
enter username password
then at the root cpanel

From your home directory( cd ~/ ), get the rpm:
$ wget http://pkgs.repoforge.org/git/git-1.7.9.6-1.el5.rf.i386.rpm
Install & Configure Git
Unpack git using rpm2cpio and cpio:
        mkdir ~/opt
        cd ~/opt
        rpm2cpio ~/git-1.7.9.6-1.el5.rf.i386.rpm | cpio -id      
Check that it is installed:
        ~/opt/usr/bin/git --version
        git version 1.7.9.6      
Configure git to work on your path and not to do SSL verification. Create a ~/.bash_profile file, if not already existing and add the following to it:(use vi ~/.bash_profile)
        export GIT_SSL_NO_VERIFY=true
        PATH=$PATH:$HOME/opt/usr/bin
        export PATH
        GIT_EXEC_PATH=$HOME/opt/usr/libexec/git-core
        export GIT_EXEC_PATH      
Check these settings by logging out and back in. Then check the version:
        git --version
        git version 1.7.9.6
       
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
to undo a commit
git reset --hard HEAD~1
will get u back by one commit
git reset --soft HEAD^     # use --soft if you want to keep your changes
git reset --hard HEAD^     # use --hard if you don't care about keeping the changes you made

Now git log will show that our last commit has been removed.
How to undo a public commit

If you have already made your commits public, you will want to create a new commit which will "revert" the changes you made in your previous commit (current HEAD).

git revert HEAD
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Change the URI (URL) for a remote Git repository
git remote -v
# View existing remotes
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL

git remote -v
# Verify new remote URL
# origin  https://github.com/user/repo2.git (fetch)
# origin  https://github.com/user/repo2.git (push)

Comments

Popular posts from this blog

Error: ios-deploy was not found. Please download, build and install version 1.9.0 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy' solution this solved the issue sudo npm install -g ios-deploy -unsafe-perm

Error: ios-deploy was not found. Please download, build and install version 1.9.0 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy' solution this solved the issue sudo npm install -g ios-deploy -unsafe-perm

How to revoke code from github?

How to revoke code from github? https://stackoverflow.com/questions/6655052/is-there-a-way-to-rollback-my-last-push-to-git Since you are the only user: git reset --hard HEAD@{1} git push -f git reset --hard HEAD@{1} ( basically, go back one commit, force push to the repo, then go back again - remove the last step if you don't care about the commit ) Without doing any changes to your local repo, you can also do something like: git push -f origin <sha_of_previous_commit>:master

preg expression regular expression details and introduction

preg expression regular expression details and introduction Useful regex examples Reference: http://www.catswhocode.com/blog/15-php-regular-expressions-for-web-developers REGULAR EXPRESSIONS SYNTAX Regular Expression Will match… foo The string “foo” ^foo “foo” at the start of a string foo$ “foo” at the end of a string ^foo$ “foo” when it is alone on a string [abc] a, b, or c [a-z] Any lowercase letter [^A-Z] Any character that is not a uppercase letter (gif|jpg) Matches either “gif” or “jpg” [a-z]+ One or more lowercase letters [0-9.-] Аny number, dot, or minus sign ^[a-zA-Z0-9_]{1,}$ Any word of at least one letter, number or _ ([wx])([yz]) wy, wz, xy, or xz [^A-Za-z0-9] Any symbol (not a number or a letter) ([A-Z]{3}|[0-9]{4}) Matches three letters or four numbers PHP REGULAR EXPRESSION FUNCTIONS Function Description preg_match() The preg_match() function searches string for pattern, returning true if pattern exists, and false otherwise. preg_match_