Category: Git
-
How to Commit in GIT
Commit code (make sure to add files first which need to be committed) git commit -m <message> Commit code to previous commit git commit –amend E.g. git commit -m ‘sample commit’ git add forgotten-file git commit –amend Undo Add git reset Undo Commit Undo git commit (changes get unstaged i.e. after modification, we need to…
-
What is Stash in GIT
Clear stash list git stash clear Show all stashes git stash list Drop a stash Removes latest stash git stash drop Removes given stash name git stash drop <name-of-stash-to-drop>
-
How to do Undo things done mistakenly in GIT
Remove file added to staging for commit Undo git add command git checkout — <filename> Discard Changes to added file to staging git checkout <filename>; i.e. checkout repository’s version Undo last commit git reset –soft HEAD^ *This command would undo commit, but would keep changes so that we can re-modify and re-commit Undoing GIT Merge…
-
How to Moving files in GIT
git mv <file1> <file2>
-
How to rename files from GIT
git mv <file1> <file2>
-
How to know the status of files Addition and Deletion in GIT
Status git status -s
-
How to Delete files from staging area
Delete files from staging area, local machine, and remote repository git rm <file-name> commit now to make changes reflected in local, staging and remote-repository
-
How to Add files to staging area
Add files to staging area git add <file1> <file2> …. and so on
-
What is GIT ignore
After every update to gitignore, follow below steps (this is useless; if you want just to ignore from git; but still keep in git) =================================================================================================== First, commit all your changes (required) # remove first everything git rm -rf –cached . # add everything again respecting gitignore file git add . git ignore but keep file…
-
What is GIT process
We would create two main branches for lifetime: master branch would always have production-ready kind of code for automation framework i.e. It should have only that code pushed which can be used by any team and is tested already by us. It should have latest test suites as well. Any push needs to be followed…