You can use the exclamation point | combing1のブログ

combing1のブログ

ブログの説明を入力します。

Recently, we published on Git basics and use Git tutorial in the team. Before we discuss those commands, it has been enough for helping a developer Git world survived. This article, we will try to explore how Nike Free Run 3 Women to more effectively manage your time and how to make use of the various functions provided by Git. Note: In this article, some commands contain fractions containing square brackets (eggit add -p [file_name]) In these examples, where you want to insert the desired number, and other identifiers. Without the need to retain the square brackets. 1.Git autocomplete if you use Git commands in the command line, type the command manually each time is a very annoying. To solve this problem, you can easily open the auto-complete function. In the Unix system, run the following command to get the script: cd ~ curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~ / .git-completion.bash Then, add in your ~ / .bash_profile file in the following code: if [-f ~ / .git-completion.bash]; then ~ / .git-completion.bashfi Although I mentioned before, here to me. still patiently said: If you want to use the full functionality provided by Git, you definitely need to turn to use the command line to operate. 2. Git to ignore files whether you appear in your Git repository compiled files (such as .pyc) tired? Also, or you have to add them Git was the last straw in this matter? Right now there is one that will allow Git to ignore certain files or directories method. Simply create a .gitignore file, then you do not want Git track lists of files and directories can be. You can use the exclamation point (!) To indicate exceptional cases. * .pyc * .exemy_db_config /! Main.pyc3. Who moved my code? After a problem to blame others, it is human nature. If your production server is a problem, you can very easily kick out the bad guys - just use the git blame command. This command displays each line of the file author, submitted for the last time after the change (commit) and the timestamp of the second submission. ʱ?? git blame [file_name] in the figure below, you can see the use of this command in a large warehouse in what it was like. 4. Recalling the history of the warehouse before the tutorial, we learned about the git log command usage, however, it has three options, you should understand. --oneline-- compressed between each submission information displayed as reduced hash value and submit information, in his show. --graph-- this option in the left-hand output interface with a text-based graphical notation to display the history. If you're just browsing a single branch of history, then this feature is of no use. --all-- display the history of all branches of the effect here is the integrated use of the above commands. 5. Never lose a commit message Say you submit a code that you do not want to Nike Free Run 3 Women submit, and finally you by using a hard reset (hard reset) make it back to the previous state. Later on, you realize that in the process you lose some additional information, and want to return, or at least to look at. git reflog command can help you do this. A simple git log command to display your recent submission of information, Nike Lebron 10.8 as well as the last time, and then on again to submit the information, and so on. The git reflog shows all head movement information. 586590-300 Nike Kobe 8 System Elite GC New Nike Free 5.0 V4 Grey Blue Running Shoes Poison Green Superhero Outlet Remember, it is local, rather than part of your warehouse, not included in the push (push) and merge (merge). If I use git log, I get the commit message is part of my warehouse. However git reflog shows a commit message (b1b0ee9 - HEAD @ {4}), this is what I use hard reset (hard Air Jordan Outlet reset) lost one. 6. New Nike Free Run 3 Shoes Silver 3 staging a file of some changes generally speaking, to create a feature-based submission is a good practice, that is, each submission must be generated on behalf of a new feature or a bug fix. Consider, if you fix the two bug, or add a number of new features but did not submit these changes will happen? In this case, you can put these changes in one submission. But there is a better way: the documents were staging (Stage) and then were submitted. For example, you modify a file several times and want them submitted separately. In this case, you can add git add -p option to add a command (add) in -p [file_name] Let us show you. I added 3 lines of text in the file_name file, and I just want to submit the first and third rows. We look at the git diff results displayed. Then we look at what happens add -p option to add commands (add) after. It looks, Git assumes that all changes are aimed at the same thing, so it put them all in one block. You have the following options: Enter y to cache the block input n does not cache the block input to manually edit the block e d to exit or enter into the next file input s to split the block for us, we certainly want to It is divided into several parts, have chosen to add some while ignoring others. As you can see, we added the first and third lines while 2015 Nike Free 5.0 ignoring the second line. You can view the status of the warehouse and after submission. 7. Merge multiple submissions when you submit your code review and created request (this happens often in open source projects) a pull, you will often be adopted Air Max 2011 Womens Purple Grey before the code is required to modify some code. You made some changes, but the next audit, will be required to conduct additional modifications. You do not know how many times to modify waiting for you, before you know it, you conducted a number of additional submissions. Ideally, you can use rebase command, put them all combined into one submission. git rebase -i HEAD ~ [number_of_commits] if you want to merge last two commits, you need the following command git rebase -i HEAD ~ 2 use this command, you will enter Air Max 2011 Womens Grey Green an interactive interface that shows the last two commits, and ask what you want to compress. Ideally, you pick a recent submission and submissions before it and squash. Next you will be asked to submit the description for this merger. This process is actually a rewrite of the history of Nike Air Max your submission. 8. Save the changes have not yet submitted Say you're solving a bug or add a new feature, when you are suddenly being asked Air Jordan Heel to show your work. Your current job is not completed to the point of committing, and you at this stage there is no way to showcase your work (if you do not roll back any changes it). In this case, git stash can save you. stash command essentially save all your changes for future use. Save your changes, you only need to run the following command: git stash scratch list view, you can run the following command: git stash list if you do not 585388-083 Anti-Nerf Nike KD V Elite Outlet want to save these changes, or you want to restore, you use the following command: git stash apply in Finally, a screenshot, you can see, every time you save has an identifier, a unique number (although we here only once saved), in case you want to use some save, you need to apply command specified identifier. git stash apply stash @ {2} 9. check for missing reflog submission method despite missing submitted a view, but it does not work in a large warehouse. At this time in relation to fsck (file system check) played. git fsck --lost-found Here you can see the missing submit, you can view these changes submitted to contain New Nike Free Run 3 Shoes Silver 3 or use git merge [commit_hash] to recover it using the git show [commit_hash]. git fsck than reglog have an advantage. For example, you delete a remote branch and clone the warehouse, you can use the fsck command to search for and recover the remote branch. 10.cherry-pick command I put the most elegant Git command to stay in the final. cherry-pick my favorite Git command because its name implies its function! In short, cherry-pick means to select a commit and merge it into the current branch coming from different branches inside. If you are in a parallel development two or more branches, you may notice that there is a bug present in all branches. If you solve it in a branch, you can use cherry-pick to put this submission incorporated into other branches and will not Nike Dunk Heels confuse other documents or submit. Let us imagine a scenario can use this command. I have two branches, and I want to b20fd14: Cleaned junk this submission using cherry-pick method put to another branch. I switched to the branch I want to put into the submissions, and then run the following command: git cherry-pick [commit_hash] Although we use cherry-pick this no problem, but you should be aware of this command will bring conflict, please use caution ʱ?? Summary of talking we came to the end of the article, I think these tips will make your Git next level. Git is the best, as long as you can imagine, it can do it. Therefore, we must always challenge their Git level. Finally, you're likely to learn something new. Gitmake your next level of 10 tips