com / original_owner / original_repository. git ( push ) # Now add the original repository to sync with your fork git remote add upstream git. git ( fetch ) > origin https :/ / github. git cd repo - name $ git remote - v # This will list your current configured remote repository for your fork # Example: > origin https :/ / github. I prefer to do this in my ~/.bash_aliases file, but the approach below is also a great option. When a pull is executed, a merge commit will be automatically created in the. You can also set up aliases for git commands. Git must merge and commit before a pull if the local branch is different from the remote branch. gitignore # For merge conflicts, run git status # Discard local file modifications with: git checkout - or Aliases Switch to the branch where you want to checkout the file. # Revert back to a working commit with (Be Careful with this!) git reset - hard Other options include - soft and - mixed # Unstage a file, but keep your changes git reset HEAD # Reset two commits git reset HEAD ~ 2 # Discard changes in a file (Be Careful with this!) git checkout - # Drop your local changes and use the server instead git fetch origin git reset - hard origin / master # Revert to the second last commit with git revert HEAD ^ # Revert a commit with a specified id git revert c7861gf # Modify your last commit message with git commit - amend - m "New Commit Message" # Add a file to a previous commit git add somefile git commit - amend - no - edit # Remove a staged file for a commit (Maybe a file you don't want tracked!) git rm - cached echo >. Here is the process to follow to get a file from another branch: 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |