- Suppose $COMMIT_id was the last commit id before you performed git pull. What you need to undo the last pull is
git reset --hard $COMMIT_id
- git diff - Show unstaged changes between your index and working directory.
- git pull - This update whole branches of local repository .
- The
git pull
command is actually a combination of two other commands,git fetch
followed bygit merge ,
it does a git fetch and then a git merge where it merges branches that have been setup to be merged in your config
current branch. "In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD
- If you want to get a file( src/main/resources/application-dev.properties) from another branch (master) to your current working branch then,
git pull origin dev
git checkout master -- src/main/resources/application-dev.properties
- To remove last commit
git pull origin dev git reset --hard HEAD~1 //Remove last commit ,1 means one last commit, if it is 2,then last two commits gitk git push origin dev --force
To change commit message use command ,
$ git commit --amend
Then window that will open , change message .Then click Esc button and type :wq
Finally push changes.
- If you are currently working on local branch master, and the new remote branch has not been created yet:
git checkout -b new_branch_name //Creates a local branch(as a copy of the current) git push origin new_branch_name //Push it to the remote server
|
No comments:
Post a Comment