//Adding to git repository
$ git init
$ git add .
$ git commit
//To see logs
$ git log
git log HEAD/HEAD~1/HEAD~2
//creating patch
git add <filepath/file name>
git commit
git format-patch HEAD~1
//applying patch
git apply --stat fix_empty_poster.patch
git apply --check fix_empty_poster.patch
git am --signoff < fix_empty_poster.patch
//Undo changes
git reset --hard HEAD ; reset to HEAD
git reset HEAD ; it will keep unstaged changes
Steps to submit a patch in git :
clone the branch
git clone <branch addess> -b <local repo name>
1. git reset --hard <commit id>
2. git remote update
3. git pull
4. Add the modified files to repository you created
$ git add file1 file2 file3
5. We can see what is about to be committed using git diff with the --cached option.
$ git diff --cached
$ git status
6. Before commiting our Changes in GIT, run the script if any. e.g. testScript.pl script
$ git diff --cached| <path>/testScript.pl --no-signoff -
7. commit your changes.
$ git commit -s
8. Push Your changes
$ git push
No comments:
Post a Comment