Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Friday, January 13, 2017

Add Remote Origin to local Git Repository


Steps to add local files to  new git repository


Step 1: Switch to your repository's directory

cd /path/to/your/repo

Step 2: Connect your existing repository to github

git init
git remote add origin https://kotturs@github.org/tech/tech.git
git pull origin master
git add
git commit -m "message"
git push origin master

Tuesday, March 1, 2016

Git Process Commands


To change from one branch to other brach

git checkout -b  
ex:  git checkout -b 3.3 



To Undo the last commit or stash the last commit
git stash    -- Do the merge, and than pull the stash:
git stash pop --get the commited files to current branch


Reset the last commit in local
To discard the local changes using
sy: git reset --hard



To change the Last commit message in git



git commit --amend

will open your editor, allowing you to change the commit message of the most recent commit. Additionally, you can set the commit message directly in the command line with:

git commit --amend -m "New commit message"



To get the patch to file (all changes to specified file)


Git diff > sample.txt