Search Unix Commands/Scripts


  Help us in improving the repository. Add new commands/scripts through 'Submit Commands/Scripts ' link.





Unix Commands/Scripts for '#Git' - 20 Commands/Scripts found

 Sample 1. Git - your branch is ahead by 1 commit error. Move Head to previous commit ( Will reset the last change )

git reset --hard HEAD~

   Like      Feedback     git


 Sample 2. Clone a repository / checkout project in Git

git clone <repository_url>

   Like      Feedback     


 Sample 3. Commands and Steps for resolving Merge conflict in Git

git fetch ( it will only bring the remote code to local but won't attempt to merge )
git status ( will show the merge conflicts )
Fix the Merge conflicts
git add .
git commit
git push

   Like      Feedback     


 Sample 4. Moving file from staging to head

git commit <file_name>

   Like      Feedback     git


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
 Sample 5. Create a Git branch

Git branch <Branch_name>

   Like      Feedback     git


 Sample 6. Push your project to Git

cd <PROJECT_ROOT_DIRECTORY>
git init
git add --all
git commit -m "<COMMIT_COMMENT>"
git remote add origin <GIT_REPO_CLONE_URL>
git push -u origin <BRANCH>

example

cd /home
git init
git add --all
git commit -m "First Commit"
git remote add origin https://xys/abc.git
git push -u origin master

   Like      Feedback     Git


 Sample 7. Moving a file to staging

git add

   Like      Feedback     git


 Sample 8. Moving file from Head on local to remote ?

git push <file_name>

   Like      Feedback     git


 Sample 9. Does git commit , commits the file to remote ?


   Like      Feedback     git


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
 Sample 10. Setting the remote project for the Git initialized local project

git remote add origin <git_repo_url>

   Like      Feedback     git


 Sample 11. Merging remote changes to local

git pull

   Like      Feedback     git


 Sample 12. Switch to a new branch in git

git checkout <branch_name>

   Like      Feedback     git


 Sample 13. Create and checkout the new branch in git

git checkout -b <branch_name>

   Like      Feedback     git


 Sample 14. Add all files to the index for commit and push in git

git add .

   Like      Feedback     


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
 Sample 15. Git commit

git commit -m "Commit Message"

   Like      Feedback     


 Sample 16. Steps in Git push from local to remote

git add .
git commit -m "message"
git push

   Like      Feedback     


 Sample 17. Change commit message in Git

git commit --amend

   Like      Feedback     git


 Sample 18. Git - Remove a Folder forced and recursively from the index

git rm -rf <folder_name>

   Like      Feedback     


 Sample 19. Git - Add only java files to the index

git add *.java

   Like      Feedback     


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
 Sample 20. Git -Force checkout another branch

git checkout -f <Branch_Name>

   Like      Feedback     git



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner