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
Post a Comment