IOS development experience summary (continuous update)

This article will continue to record their own learning, work, contacts and iOS development related technologies. Including writing code is easy to overlook the details of the project, access to practical technology and excellent three party framework. Welcome to the collection, the point of praise, if there is insufficient welcome to refer to explore together, common progress.

Section One – Coding Tips

1 prefix for private method name

  • This suggestion is that I recently read “Effective Objective-C 2” to know.
  • Because a class has to do more often than it does. In the m file, often write some internal code. And we should add some prefixes to these methods, which helps to debug, because it is easy to separate the common and private methods.
  • Specific use of what prefix can be based on personal preferences, there is no fixed standard. But one thing to note is that Apple’s official name is reserved for a private method with a single underscore
  • If you want to imitate the wording of Apple also uses a single underscore, it is likely to inadvertently rewrite the parent of the same name method, resulting in a lot of puzzling questions.
  • I personally like the private method in the form of p_methordName named P that represents pravite.

2 the proposal to write enumeration to imitate apple – in the enumeration of the contents of the same time the enumeration of the data type NSUInteger, the benefits are enhanced type checking and better code readability, examples:

Typedef NS_ENUM (NSUInteger, GPSectionType) {GPSectionTypeNone = 0, GPSectionTypeNews = 1, GPSectionTypeInformation = 2,};

3 header file #import order

  • Template #import < system library > #import < third party library > #import”
  • As far as possible in accordance with the first class of third class system to write their own order of the middle class can not enter the space
  • Suggested wording
#import< UIKit/UIkit.h> #import< Google/Analytics.h> #import "GPCustomView.h

[email protected] writing

  • Template: @class Class1, class2;
The proposed wording of @class / / UIView / / UIImage; do not recommend writing @class UIView; @class UIImage;

5 declare const string

  • Start with K logo
  • Recommended k+ template name first letter capital + role name to prevent and other repeat
  • For example, the CartViewModel class needs to declare a notification for updating the cart list kCVMNoticationUpdateCartList

6 try to control up to fifty lines

  • A method inside up to fifty lines
  • If you exceed the code on the separation method to write
  • Easy to carry out after the heat recovery code refactoring

7 note must write

  • Management of their own class must be used to explain the use of the attribute parameters of the description
  • If the default value is set, the default value is specified
  • If there is a way to determine the logic of the method to jump to a certain note to determine the use of the method to jump
  • In addition to initialization
  • Other declaration variables should be annotated for the purpose of valuation
  • Notes * @brief / * * * * @param live send gifts gift gift * @param groupId ID * @param count studio number success * @param * @param failure failed success callback callback * + (void) readySendGiftWithGift: (MoerLiveRoomGift*) gift groupId: (NSString*) groupId count: (NSInteger) count (success: (void ^) (Goods *goods) success failure: failure (Failure)); / * * * @brief according to the dictionary information instantiation order * * * * @return @param dictionary dictionary order case – * / (instancetype) initWithDictionary: (NSDictionary*) dictionary;

  • Property comments
* * / / * * reward object @property (nonatomic, copy) NSString *targetId;

  • Enumeration comment
Typedef NS_ENUM (NSInteger, MoerGoodsType) {/ * * / * * * * NO * / MoerGoodsTypeNone, the * / MoerGoodsTypeArticle = 1, MoerGoodsTypeActivity = 2 * / / * * *}

8 header files are introduced into other classes when using @class

  • Can prevent the introduction of each other led to Compile failure, resulting in not easy to find bug
  • At the same time, use #import to import the corresponding class in the.M file

9 use pragma mark

  • In particular, a controller contains a lot of business logic, can make the structure more clear

Naming conventions for 10 controls

  • Do not use abbreviations, password do not write PWD, button do not write BTN, etc.;
  • UILabel ends with Label;
  • UIImageView ends with ImageView
  • Wait for other programmers to see the name to know what the variables and what controls

11 for #define macro naming

  • Between words all uppercase words with _ segmentation
  • Suggested wording

12 initialization for local variables as much as possible

  • Local variables are initialized to have a default value so we do not have to initialize the property
  • One of the BUG I encountered before was the int type that did not initialize to my default Nan crash
The correct wording of int / index = 0; / / error writing int index;
  • For some objects to determine whether the assignment can not be initialized but for the nil will not be initialized

Naming conventions for 13.block

  • Prior to the study of a lot of names of the third parties did not find Apple’s official
  • There are CallBack ending Complete end of the Block and the end of the CompletionHandle
  • I saw a lot of apple CompletionHandle is used at the end of the end of writing typedef void / / proposal (DidUpdateViewCompletionHandle) (void) / / not recommended the transcription typedef (DidUpdateViewCallBack) void

14 remove notifications in the dealloc method

- (void) dealloc {[[NSNotificationCenter defaultCenter] removeObserver:self];}

15 attributes to try to use lazy loading

  • We have a lot of control interface
  • Lazy loading can beautify the code
  • All lazy loads are placed below the mark Getter

16 use more literal

  • NSString @””
  • NSNumber @ ()
  • NSDictionary @{}
  • NSArray @[]

17 to add a class to add the prefix for the third party

  • For example, add the Add UIView prefix for the system
@interface UIView (GP_Add) - (void) gp_addCustomView: (CustomView *) customView; @end;

18 arrays and dictionaries best specify the type of element

NSArray< NSString *> *names = [NSArray array];

Section Two – Work Experience

1 recommended loading Xib, Xib name with NSStringFromClass (), to avoid writing errors

[self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass / / recommended writing ([GPTableViewCell class]) bundle:nil] forCellReuseIdentifier:ID]; / / [self.tableView registerNib:[UINib nibWithNibName:@ is not recommended "GPTableViewCell bundle:nil] forCellReuseIdentifier:ID]";

2 when you define a cell, the reuse identifier is bound to the cell file, rather than defining a stack of reuse identifiers in the controller

  • In.H
#import "GPBaseCell.h" UIKIT_EXTERN NSString * const; @interface GPContentCell: GPBaseCell @end GPContentCelltCellIdentifier
  • In.M
#import "GPContentCell.h" NSString * const "@ GPContentCell =" GPContentCell "; @interface (GPContentCell) @property (weak, nonatomic) IBOutlet UILabel *contentLabel; @end @implementation MoerQAAskerContentCell (void) awakeFromNib {[super awakeFromNib]; self.selectionStyle = UITableViewCellSelectionStyleNone; self.contentLabel.textColor = [UIColor redColor];}
  • UIKIT_EXTERN simply, is to modify the function is compatible with the previous C compiler, with the extern attribute (outside the file visibility), public modified methods or variables can still be visible outside the library
  • Reference material

3 use XIB to create custom View

  • We create a class that inherits from UIView, and the underlying Also Creat XIB file is in a state of grey. Apple may not be recommended to do so, but we can still create a separate View file associated with it.
  • Declare an initialization method in the.H file
- (instancetype) initWithXib;
  • Implement it in.M
- (instancetype) initWithXib [[[NSBundle mainBundle] {self = loadNibNamed:NSStringFromClass ([self class]) owner:nil options:nil] lastObject]; / / UI return initialization settings to adjust the style... Self;}

4 good at using autoresizingMask Technology

  • For a relatively simple, single parent-child view
  • Under normal circumstances, determine the position of a child control in its parent control, we only need to determine two effective in 4 directions is enough, if more than two effective direction, so much out of the direction constraint will be replaced. Specifically, there are 4 constraints in the direction of the line is a priority, the top of the constraint line priority is higher than the bottom of the constraint line, the left of the constraint line priority higher than the right side of the constraint line. If you restrict the left and right, so is the role of the left; if you at the same time constraints above and below, it is the role of it; if you at the same time constraints in 4 directions, as is the upper left corner. In order to ensure that the constraint is valid, it can not be constrained at the same time.
  • Reference material

5 stretch pictures

  • Sometimes UI to the picture can not meet our needs, this time we have to deal with their own simple picture.
  • For example, to stretch a picture edgeInsets
  • The method involved
- (UIImage) resizableImageWithCapInsets: (UIEdgeInsets) capInsets NS_AVAILABLE_IOS (5_0); / / create a resizable version of this image. the interior is tiled when drawn. (UIImage) resizableImageWithCapInsets: (UIEdgeInsets) capInsets resizingMode: (UIImageResizingMode) resizingMode NS_AVAILABLE_IOS (6_0); / / the interior is resized according to the resizingMode
  • Picture stretching technique
  • Course
  • Reference material

6 use SDWebImage to set the picture to button

The first step: / / import header file #import < SDWebImage/UIButton+WebCache.h> / / the second step: to call the method and set for [self.avatarButton sd_setImageWithURL:[NSURL URLWithString:model.avatarUrlString] forState:UIControlStateNormal placeholderImage:[UIImage, imageNamed:@ "PlaceholderImage" ";

7 use SDWebImage to load GIF images

The first step: / / import #import file "UIImage+GIF.h" / / the second step: to call the UIImage method of *hoopImage [UIImage sd_animatedGIFNamed:@ = "hula_hoop"]; self.hoopImageView [[UIImageView alloc] = initWithImage:hoopImage]; self.hoopImageView.frame = CGRectMake (10, 10, 100, 100); [self.view addSubview:self.hoopImageView];

8 use the dSYM file to find the online program crash log

  • What is the dSYM file Xcode to compile the project, we will see a dSYM file with the same name, dSYM is saved 16 hexadecimal address mapping information file transfer function, we debug the symbols are included in this document, and every time you compile the project will generate a new dSYM file in the /Users/&lt user name > /Library/Developer/Xcode/Archives; directory, for each release we are necessary to save the corresponding Archives file.

  • What is the role of the dSYM file when our software pack or release mode on the line, not like us in a Xcode like with intuitive to see the crash, this time we need to analyze the crash report file, iOS equipment will save the log file memory address function we each application error by Xcode Organizer can be exported DeviceLog’s iOS devices into crash files, this time we can use the error function address to query program dSYM file corresponding to the function name and file name. The premise is that we need to have a software version of the corresponding dSYM file, which is why we need to save each release version of the Archives file.

  • How will the file corresponding to each of the and the file has a corresponding UUID file, crash has its own UUID, as long as the three documents of the UUID agreement, we can through their analytical error function with the correct information.

  • 1 view file UUID, terminal command:
    dwarfdump –uuid (XX on behalf of your project name)
  • 2 view the file UUID, terminal command:
    dwarfdump –uuid
  • The first line Incident 3.crash in the Identifier file is the crash file of the UUID.

9.block notes

  • When a block is declared as an attribute in a class, if assgin is used, it is placed in the stack and the method is destroyed once it is destroyed,
  • So, try to use copy as a modifier, so that block is stored in the heap, the life cycle will be extended to ensure that block will not be immediately destroyed;
  • To prevent circular references, it is usually necessary to give a weak reference outside the block, and then a strong reference to the block.
  • __weak typeof (self) weakSelf = self;
  • __strong typeof (self) strongSelf = weakSelf;
  • When using block to judge
If (self.backBlock) {self.backBlock (self.textView.text)}

10 do not submit the local debugging code to Git

  • If you forget to change before submitting, be good at using macros
  • The following code will only run in debug mode
  • If switching to release mode does not run #ifdef DEBUG = YES; #else = NO; #endif; isDebug; isDebug

11 use custom tag warnings

  • / / TODO: logo to be completed in the future content;
  • After identification / / FIXME: to revise or perfect content.
  • / /??? Question: where
  • Always!!!: the need to pay attention to the place

12 use runtime related objects

  • Runtime associated objects
  • Jane Book tutorial 1:runtime related objects
  • Jane Book tutorial 2:runtime related objects

13 use contentMode to make the picture look good

  • Reference 1
  • Reference 2

14 control font color settings while using IBOutletCollection

  • For many of the controls we may sometimes have to set the same color or font size, this time we do not have to drag each control into the property, but the use of IBOutletCollection unified settings
  • Reference 1
  • Reference 2

15 modify the status bar font color

/ / first to write a property @property (nonatomic, assign) UIStatusBarStyle statusBarStyle; / / to modify the status bar according to the specific needs of the style of self.statusBarStyle = UIStatusBarStyleLightContent; self.statusBarStyle = UIStatusBarStyleDefault / White / black; / / tell the system to update the status bar style [self setNeedsStatusBarAppearanceUpdate]; / / override this method, a new style will be returned to the system - (UIStatusBarStyle) preferredStatusBarStyle {return self.statusBarStyle;}

16 close the refresh section animation effects

Although the animation is the choice of / / UITableViewRowAnimationNone / / but actually will animation [self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:GPSectionTypeNews] withRowAnimation:UITableViewRowAnimationNone];
  • Correct practice
[UIView performWithoutAnimation:^{[self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:GPSectionTypeNews] withRowAnimation:UITableViewRowAnimationNone]}];

17 good at using the round/ceil/floorf function

  • Round: if the argument is a decimal, then ask yourself four homes into the five.
  • Ceil: if the argument is a decimal, ask for the smallest integer but not less than itself
  • Floor: if the argument is a decimal, ask for the largest integer but not greater than itself
Example: how the value is 3.4, then 3.4 - round 3 - ceil 4 - floor 3

18.APP call

  • One method
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@ "tel://010-88888888" ";

  • Method two
#import < UIKit/UIWebView.h> UIWebView * callWebview = [[UIWebView alloc]init]; [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@ tel:010-88888888 [[UIApplication sharedApplication].keyWindow addSubview: callWebview]]]];
  • Difference
The first one will be out of the program to the system of the call program, the second is always running in their own app, did not go out. Two difference: the first trigger directly to the phone interface, the first one will pop up a dialog box, you can choose not to make a phone call, the dialog box is as follows: second.
IOS development experience summary (continuous update)

19 good at using UIStackView

  • Tutorial links

20.iOS animation used in detail

  • Tutorial links

21 using NSTextAttachment to achieve image mixing

NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] / initWithString:[NSString stringWithFormat:@, article.title]] NSTextAttachment "% @"; *textAttachment [[NSTextAttachment = alloc] initWithData:nil ofType:nil]; textAttachment.image [UIImage imageNamed:@ = "icon"]; CGFloat offsetY = -1.0; textAttachment.bounds = CGRectMake (0, offsetY, textAttachment.image.size.width, textAttachment.image.size.height); NSAttributedString *textAttachmentString = [NSAttributedString attributedStringWithAttachment:textAttachment]; [titleString insertAttributedString:textAttachmentString];
  • Rich text AttributedString summary (a) rich text AttributedString summary (two) rich text AttributedString summary (three)

22.TextKit learning

  • TextKit

23 payment related

  • Jane course
  • IOS access Alipay payment

24 on the use of dispatch_semaphore

  • Reference address

25.NSStringFromSelector (_cmd) description

  • _cmd represents the name of this method

  • _cmd is the hidden parameters, representing the current methods of selector parameters, he and self are the same as each method call will be introduced, the dynamic runtime will mention these two parameters to pass the
    , you joined CCLOG method (@/ “% @,%@/” (_cmd), NSStringFromSelector, self); after the statement, this method will output the execution method of
    , this is done in order to check the tracking method call sequence, or want to see the program in the end in the method of internal collapse!

  • See understatement to say a sentence in the Apple official: “The _cmd variable is a hidden argument passed to every method that is the current selector”, namely _cmd in the method of Objective-C said the current method is the same as self selector, said the current method call on……

26.iOS method warning

  • When Apple SDK upgrade to abandon some of the methods, you need a warning.
  • External call method warning __deprecated_msg (method obsolete, please replace…)
  • Current method warning
__attribute__ (visibility ("warning"));
  • as
- (void) test __deprecated_msg ("method obsolete, please replace...") (visibility (__attribute__) ");

  • Jane course

27 friends pushed the pit

  • First of all the friends of the union push is divided into the development environment and production environment, the development environment is that we in the development stage, has not applied to app store shelves, then we according to friends of the union of the official document integration push message alliance.
  • And then when to test, this time choose the test mode for testing, to obtain the current method in the following device token, then add the test mode of test equipment, as long as the upload certificate is not wrong, sending a message mobile phone can receive push message
- (void) application: (UIApplication * application) didRegisterForRemoteNotificationsWithDeviceToken: (NSData * deviceToken) {NSLog (@ [[[[deviceToken description] @% @ "stringByReplacingOccurrencesOfString:" < "withString:" "stringByReplacingOccurrencesOfString:"] @ @ @ > "withString:" "stringByReplacingOccurrencesOfString:" "withString:" @ @ ""]);}
  • Development environment can only be tested in the test mode, the message list that can only be app on the line, into a production environment before you can send a message in the message list test.
  • App on the line, the first day of the general sent a push message is a failure, because the device token in the League of friends over there in one day delay, which can be read this article on the League of friends on the interpretation of iOS devicetoken is invalid
  • Click on the app message to jump to the specified page, divided into the current app is in the foreground or background of the latter is not running, so the need to
- (void) application: (UIApplication * application) didReceiveRemoteNotification: (NSDictionary *) userInfo - (BOOL) application: (UIApplication * application) didFinishLaunchingWithOptions: (NSDictionary * launchOptions)
  • Two ways to write the page Jump, the background and the need for a good pass over the message needs to jump to the page, and then do their own jump, page Jump can only operate in their own code

  • Push message has been shown to send a failure, I do not know how to find the reason, find the customer service many times, said device token invalid, re access, but to get a lot of times is also invalid
  • Later met kindly suggested the check certificate package name and bundle ID are the same, then push open the certificate in your keychain is uploaded to the friends of the union, found the package name is not the same, but the certificate of the production process there is no error, so think impassability, delete, upload, re export certificate. OK. Can push. If the user opened for the first time that app is not allowed to push back, opened in the settings allow push is also possible, because the first time you run app in the first open day and will send token to friends of the union of the server, so push switch opening and closing does not affect token.
  • Finally, if you need to install the application in the production environment to test the device, or APP and does not need to push the assembly on the line, to be packaged in Ad Hoc application reference address

28 configuration Gitlab

  • GitLab is the enterprise version of the GitHub, and GitLab is open source, that is, can be deployed to their own network.
  • If the configuration of the SSH public key or not through the Sourcetree to pull the company’s code on the local computer, it may be your boss forgot to open your Gitlab account permissions
  • Simple use of GitLab

29 filter out the string before and after the space

  • Sometimes the server before and after the data will be returned with /n
  • We can call the following method to remove it
NSString* trimedURL = [stringURL stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

Section Three – Third Party

1 a very powerful text editor

  • GitHub address

2 achieve the top pop HUD

  • GitHub address

3 very useful to load a pop-up

  • GitHub address

4 each network request is encapsulated into an object’s Network Library

  • GitHub address

5 make response gestures easier

  • GitHub address

6 let each attempt controller has an independent navigation bar

  • GitHub address

7 draw charts, line chart framework

  • GitHub address

8 something better than UISegmentedControl

  • GitHub address

9 essential carousel figure

  • GitHub address

10.tableView artifact

  • GitHub address

11 super powerful open source framework

  • GitHub address

12 small drawer display

  • GitHub address

13 slide drawer

  • GitHub address

14 night mode

  • GitHub address

15 picture browser

  • GitHub address

16.HTML tag resolution

  • GitHub address

Section Four – Development Tool

1 capture network requests – Charles

  • An instruction manual

2 switch host tool – Gas Mask

  • An instruction manual

3 efficient editor – Subline Text

  • The official website

4 analog send network request – Postman

  • The official website

5 graphical Git tool – SourceTree

  • The official website
  • Basic tutorial

6 Analysis of others APP interface – Reveal

  • Basic tutorial

7 essential Shadowsocks wall

  • GitHub address

8 shortcuts too much to remember? – Cheetsheet

  • introduce

Section Five – About Git

A lot of people do iOS development, the first contact may be easy to use Sourcetree, remember the merger of the code of the steps, and then contact git. In order to better understand the Sourcetree to do every step, it is necessary to study the broad and profound git, the following is my cramming knowledge of GIT notes, thank Liao Xuefeng teacher write git tutorial. Git tutorial

  • Create a folder (default path: /Users/fsl/learngit) MKDIR learngit
  • Enter the folder CD learngit
  • Show current directory PWD
  • Initialize git warehouse git init
  • Add the file to the GIT warehouse git add < file> git commit commit -m “submit information”
    IOS development experience summary (continuous update) git
  • View the status of the current warehouse git status
  • View changes to a file in the current warehouse git diff readme.txt
  • Displays the most recent submission log from git to log
    IOS development experience summary (continuous update)
  • The version of the –hard version of the GIT reset HEAD^ HEAD commit_id is the current version, therefore, Git allows us to shuttle between the history of the version, using the command git reset –hard. Before the shuttle, with git log can view the history of submission, in order to determine which version to back to. To return to the future, use git reflog to view command history in order to determine which version to go back to the future.
    IOS development experience summary (continuous update)

Version Library (Repository)

IOS development experience summary (continuous update)
  • See the difference between the workspace and the latest version of the library git diff HEAD – readme.txt
  • Undo modify git checkout – readme.txt checkout – file command – very important, no -, it becomes a switch to another branch of the command
    IOS development experience summary (continuous update)
  • Undo the changes that have been submitted to the staging area (re put back to the workspace) git reset HEAD git reset command can either back up the version, you can also modify the temporary area back to the workspace. When we use HEAD, the latest version.
  • Delete the file RM test.txt checkout is in fact the version of the version of the replacement version of the workspace, regardless of the work area is modified or deleted, can be a key to restore the”. Command git RM to delete a file. If a file has been submitted to the repository, so you never have to worry about mistakes, but be careful, you can restore the file to the latest version, you will lose the last commit after you modify the contents of.

Add to remote warehouse

  • Associated with a remote library git add origin remote
  • Git push -u master (for the first time to push all the contents of the master branch) to push the contents of the local library to remote, with the GIT push command, in fact, the current branch master pushed to remote. Because the remote database is empty, we first push master branch, together with the -u parameter, Git master will not only push the local branches of the new remote master branch, but also to the local master branch and remote branch association of master in the future, push or pull when we can simplify the command.
  • Since then, each time after the local submission, as long as necessary, you can use the command git push master origin push the latest changes;
  • From now on, as long as the local made the submission, you can git push master through the latest modification of the local master branch pushed to GitHub, now, it has a real distributed version of the library!

View branch

  • Git branch

Toggle branch (create new branch)

  • Git checkout -b dev
  • The addition of the GIT checkout command and the -b parameter indicates that the creation and switch is equivalent to the following two commands: $git branch $git checkout dev Switched to branch’dev’
  • Switching branch git checkout < name>

Merge the specified branch (DEV) to the current branch (Master)

  • Git merge dev

Delete branch

  • Git branch -d dev
  • View branch git branch

View branch diagram

  • Git log –graph
  • Git log –graph –pretty=oneline –abbrev-commit

Branch management strategy

  • Typically, when merging branches, Git will use the Fast Forward (fast forward) mode, that is, to change the pointer to
    IOS development experience summary (continuous update)
IOS development experience summary (continuous update)
IOS development experience summary (continuous update)
IOS development experience summary (continuous update)
  • The use of Fast Forward model has a drawback, that is, delete the branch, will lose the branch information.
  • If you are forced to disable the Fast Forward mode, Git will generate a new commit at merge, so you can see the branch history in the branch history. Git merge -m “merge with no-ff” dev because the merger will create a new commit, so to add -m parameters, the description of the commit write in.
IOS development experience summary (continuous update)

Bug branch

  • When we fix bug, we will repair it by creating a new bug branch, then merge, and finally delete;
  • When the work is not completed, the first work site git stash, and then to repair bug, repair, and then git stash pop, back to the work site.
  • View the temporary list git stash list
  • Return to work on-site with git stash apply: a recovery, but the recovery after the hidden content is not deleted, you need to use git stash drop to delete; two: git stash pop, at the same time the recovery stash content is deleted

Feature branch

  • Add a new function, you certainly do not want to because of some experimental code, the main branch of messing up, so each add a new function, the best of a new feature branch, in the above development, after the completion of the merger, finally, delete the feature branch.
  • One possibility is that the branch was developed to half, was informed of the cancellation of new features. The GIT branch -d executive branch, is not delete branch git will remind you that the branch has not yet been merged, if will be lost if you want to delete modify delete, need to use the command git branch -D branch.

Multi person cooperation

  • Many people work usually is like this: firstly, GIT push origin branch-name can try to push their own changes; if the push failed, because the remote branch than your local update, need to use git pull to merge with it; if the conflict, conflict resolution, and in the local submission; there is no conflict or to solve the conflict, and then git push origin branch-name will be able to successfully push!
  • If the GIT pull prompt “no tracking information”, the link between the local and remote branches is not created, with the command git branch branch-name origin/branch-name.
  • View remote warehouse information git remote -v
  • If the new branch is not pushed to the remote, it is invisible to others
  • From the local push branch, the use of push origin branch-name, if the push fails, the first use git pull to grab the remote New submission;
  • The local and remote branches corresponding to the branch, using the GIT checkout branch-name origin/branch-name, the name of the local and remote branches the best consistent

Label management

  • When we release a version, we usually make a tag (tag) in the repository, so that the only version of the tag time is identified. Any time in the future, take a label version, that is the time to mark the label to take out the historical version. So, the tag is also a snapshot of the repository.
  • Tag is a meaningful name that is easy to remember, tied to a commit.
  • Git tag &lt name&gt to create a label;; for a new label, the default is HEAD, you can also specify a commit ID git tag -a < tagname> -m “blablabla…” you can specify the label information; git tag tagname> -s < -m “blablabla…” you can use the PGP command Git tag signature label; view all tags
  • The operation of GIT tag -d &lt to delete the tag tag; tagname> push a local label to the remote git push origin < tagname> not all one-time push onto the local git push origin label –tags remote Delete remote label first delete local label git tag -d < tagname> git push origin refs/tags/&lt in use tagname>; Delete remote Tag

Ignore file

  • Some files need to be written.Gitignore
  • .gitignore file itself into the version library, and can do version management.Gitignore

Use rebase instead of merge

  • In order to allow the timeline of the submitted code to be a straight line instead of a variety of bifurcations, we want to use the rebase (variable basis)
  • About rebase knowledge can see the link below
  • Git rebase usage notes


Learning proficiency for officialdom, not a pleasure.